User:Andy Maloney/Notebook/Lab Notebook of Andy Maloney/2011/04/18/Installing Java: Difference between revisions
Andy Maloney (talk | contribs) (New page: {{AndyMaloneyNotebook |Description=This page describes my install of Eclipse on Linux and the typical "hello world" first program. }} Category:AM_Java ==Installation==) |
Andy Maloney (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
[[Category:AM_Java]] | [[Category:AM_Java]] | ||
==Installation== | ==Installation== | ||
Installation of Eclipse was simple on Linux Mint 10. I just downloaded the Classic version of Eclipse and started it up. I added a link in my main menu as well. | |||
==Workspace== | |||
I added a workspace in the directory that has Eclipse in it. I think I'll keep it there from now on. | |||
==Tutorial== | |||
So there is a tutorial section that is supposed to get you to make a "hello world" application. I did it and was asked to write the following: | |||
<source lang="java"> | |||
public class HelloWorld { | |||
public static void main(String[] args) { | |||
System.out.print("Hello world!"); | |||
} | |||
} | |||
</source> | |||
It's funny but I didn't add the ''ln'' after print and the program worked. I suppose for absolute strictness, one should include the ln in code so that it reads: | |||
<source lang="java"> | |||
public class HelloWorld { | |||
public static void main { | |||
System.out.println("Hellow world!"); | |||
} | |||
} | |||
</source> | |||
From what I understand, ''public'' is a declaration of the method used in the code. For the above case, my class is named HelloWorld and it is ''public'' to all the subclasses in the code. I suppose that if I was to have a subclass in the main section that I didn't want to be visible to other sections in the code, I wouldn't label it as ''public''. I'd label it as something else, what ever that is. | |||
I remember from C that ''void'' is not supposed to return a value and is usually accompanied with ''main''. | |||
''Static'' apparently means that the method is tied to the class. I don't think I understand this though. |
Revision as of 13:00, 18 April 2011
Installation
Installation of Eclipse was simple on Linux Mint 10. I just downloaded the Classic version of Eclipse and started it up. I added a link in my main menu as well.
Workspace
I added a workspace in the directory that has Eclipse in it. I think I'll keep it there from now on.
Tutorial
So there is a tutorial section that is supposed to get you to make a "hello world" application. I did it and was asked to write the following:
<source lang="java"> public class HelloWorld { public static void main(String[] args) { System.out.print("Hello world!"); } } </source>
It's funny but I didn't add the ln after print and the program worked. I suppose for absolute strictness, one should include the ln in code so that it reads:
<source lang="java"> public class HelloWorld { public static void main { System.out.println("Hellow world!"); } } </source>
From what I understand, public is a declaration of the method used in the code. For the above case, my class is named HelloWorld and it is public to all the subclasses in the code. I suppose that if I was to have a subclass in the main section that I didn't want to be visible to other sections in the code, I wouldn't label it as public. I'd label it as something else, what ever that is.
I remember from C that void is not supposed to return a value and is usually accompanied with main.
Static apparently means that the method is tied to the class. I don't think I understand this though.