New Posts  All Forums:Forum Nav:

Basic Java help? - Page 2

post #11 of 24
Thread Starter 
Quote:
Originally Posted by Plex View Post
Try changing the declaration to:

public long calculateVolume()

(no semi-colon)

Edit: Beaten by a mere second.

Anyway, you don't want to use the semi-colon when you are defining a method like that. Every time you use a semi-colon, you're saying "this is the end of this statement." So nothing in the brackets after that was attached to the proper method. Feel me?
Thanks Plex I realise this now!!
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #12 of 24
Syntax syntax syntax! I hate missing simple syntax errors, happens all the time though
    
CPUMotherboardGraphicsRAM
i7 2600k ASRock P67 Extreme4 MSI GTX 580 Lightning 2x4GB Corsair Vengeance DDR3 1866 9-10-9-27-1T 
Hard DriveOptical DriveCoolingOS
Mushkin 60GB SSD + 2xWD Black 500GB RAID0 Sony DVD-RW Noctua NH-D14 Windows 7 
MonitorKeyboardPowerCase
LG 22" 1080p + Acer 18" Das Keyboard - MX Blue Antec TruePower New TP-650 Cooler Master HAF 922 Black 
Mouse
Logitech 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i7 2600k ASRock P67 Extreme4 MSI GTX 580 Lightning 2x4GB Corsair Vengeance DDR3 1866 9-10-9-27-1T 
Hard DriveOptical DriveCoolingOS
Mushkin 60GB SSD + 2xWD Black 500GB RAID0 Sony DVD-RW Noctua NH-D14 Windows 7 
MonitorKeyboardPowerCase
LG 22" 1080p + Acer 18" Das Keyboard - MX Blue Antec TruePower New TP-650 Cooler Master HAF 922 Black 
Mouse
Logitech 
  hide details  
Reply
post #13 of 24
Quote:
Originally Posted by kidshenlong View Post
Thanks Plex I realise this now!!
Anytime . The best part is that now you know where to look first when you see a "return outside method" compile error. You have to learn somehow!
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
post #14 of 24
No problem, just glad i can help... Its always the silly mistakes that get you hung up in the beginning.
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
post #15 of 24
Thread Starter 
Quote:
Originally Posted by Dissentience View Post
Syntax syntax syntax! I hate missing simple syntax errors, happens all the time though
Don't we all!

Quote:
Originally Posted by Plex View Post
Anytime . The best part is that now you know where to look first when you see a "return outside method" compile error. You have to learn somehow!
Indeed!

Quote:
Originally Posted by mykah89 View Post
No problem, just glad i can help... Its always the silly mistakes that get you hung up in the beginning.
I think I just need to start programming everyday and getting a hell of a lot more familiar with it.

I also have one last quick question.

Could someone explain to me exactly what a three arm constructor is. Google isn't that clear. And according to my notes I should've used it in that little bit of code but not too sure if I have...
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #16 of 24
Having never heard that specific term before i can only assume it just means a constructor with 3 parameters or "arms" as you referred to it.

In your tank class you declared three private variables.

Constructors, as indicated inside a class, using the class name, are used to set the initial state of the instance of the class.

When you created the class you specified the three parameters length width and depth, the constructor set the private instance variables long length, width, depth based on the parameters you fed it.

Code:

class Tank
{
private long length;
private long width;
private long depth;


Tank(long l, long w, long d)  <-- your Tank class' constructor
{
length = l;
width = w;
depth = d;
}

}

To further clarify:

Tank calcTank = new Tank(length, width, depth);

That says,
initialize a new instance of the Tank class,
set the reference to the class as the name calcTank,
call the Tank class' constructor which accepts three parameters (length, width, depth)
Edited by mykah89 - 2/23/11 at 9:58am
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
post #17 of 24
Thread Starter 
Ahhh thanks again mykah89/ Where'd you learn all this stuff!! You're like a box of knowledge.... Rep+
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
post #18 of 24
I have never heard of the term "three-arm contructor" either, but I was also thinking what mykah89 said
    
CPUMotherboardGraphicsRAM
i7 2600k ASRock P67 Extreme4 MSI GTX 580 Lightning 2x4GB Corsair Vengeance DDR3 1866 9-10-9-27-1T 
Hard DriveOptical DriveCoolingOS
Mushkin 60GB SSD + 2xWD Black 500GB RAID0 Sony DVD-RW Noctua NH-D14 Windows 7 
MonitorKeyboardPowerCase
LG 22" 1080p + Acer 18" Das Keyboard - MX Blue Antec TruePower New TP-650 Cooler Master HAF 922 Black 
Mouse
Logitech 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i7 2600k ASRock P67 Extreme4 MSI GTX 580 Lightning 2x4GB Corsair Vengeance DDR3 1866 9-10-9-27-1T 
Hard DriveOptical DriveCoolingOS
Mushkin 60GB SSD + 2xWD Black 500GB RAID0 Sony DVD-RW Noctua NH-D14 Windows 7 
MonitorKeyboardPowerCase
LG 22" 1080p + Acer 18" Das Keyboard - MX Blue Antec TruePower New TP-650 Cooler Master HAF 922 Black 
Mouse
Logitech 
  hide details  
Reply
post #19 of 24
I struggled along just like you, looking up answers and asking questions when i needed help.

I strongly recommend that you make sure you understand basic class structure and function definitions/syntax. You will really appreciate taking the time to understand the basic structure and syntax of object oriented programming when you get to some of the more difficult stuff.
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
I5 760 GA-H55N GTX 470 PNY Optima 8GB 
Hard DriveMonitorPowerCase
Spinpoint F4 LG227WTG sg07 PSU Sugo sg07 
Mouse
CM Sentinel 
  hide details  
Reply
post #20 of 24
Thread Starter 
Quote:
Originally Posted by mykah89 View Post
I struggled along just like you, looking up answers and asking questions when i needed help.

I strongly recommend that you make sure you understand basic class structure and function definitions/syntax. You will really appreciate taking the time to understand the basic structure and syntax of object oriented programming when you get to some of the more difficult stuff.
Argh I meant argument not arm :s I really don't know why I said arm instead lol but I'm sure the same applies. Thanks for all the help dude, I'll try my hardest to look into that. Any sources or books you'd suggest that provide this information in an understandable way?
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
Dark Star
(13 items)
 
  
CPUMotherboardGraphicsRAM
Q6600 - Currently Overclocking ;) Gigabyte GA-EP45-UD3P HD 6950 OCZ Blade LC DDR2 PC29200 4GB (GOT) 
Hard DriveOSMonitorKeyboard
640GB for Storage and OCZ Vertex 2e 60GB Windows 7 Ultimate-Signature Edition 3 x 22" -BenQ G2222HDL Logitech G15 
PowerCaseMouse
Corsair TX850 HAF 932 Logitech G500 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming