| Java/Coding people, please help? Okay, so I'm starting my first ever programming class this fall quarter and I decided to learn the basics of programming before because I know there'll be geeks in the class I'm going to take and I don't want to be left behind.
Here's what I have thus far:
Applet
public class RootApplet extends java.applet.Applet {
int number;
public void init() {
number = 225;
}
public void paint(java.awt.Graphics g) {
g.drawString("The square root of " +
number +
" is " +
Math.sqrt(number), 5, 50);
}
}
and normal
class NewRoot {
public static void main(String[] arguments) {
int number = 0;
if (arguments.length > 0)
number = Integer.parseInt( arguments[0] );
System.out.println("The square root of "
+ number
+ " is "
+ Math.sqrt(number) );
}
}
I basically used an online tutorial and it went through this. Do the functions (which I'm guessing are class NewRoot and public static void main) always need to come before the commands to the program?
How do you know where to space the brackets and other commands? It seems that spacing is a BIG issue and that's something I've yet to figure out. The tutorial says nothing about the incredible important of spacing and blank lines.
Please help. QQ
__________________ VOCA ME BENEDICTUM !
SANA MEAM ANIMAM ! |