Difference between revisions of "Team2/Creating a Java Class"
(Created page with '=Guide Line= *To create a java class, right click on the package we created earlier (firstAPP) then highlight "New" and scroll down to "Class" *Under the name text box, enter "L…') |
|||
Line 8: | Line 8: | ||
package firstAPP; | package firstAPP; | ||
− | public class | + | public class LabExercise1 { |
− | public int c = 4; | + | public int c; |
+ | |||
+ | public LabExercise1(){ | ||
+ | c=4; | ||
+ | } | ||
public void printHello() { | public void printHello() { | ||
System.out.println("Hello"); | System.out.println("Hello"); | ||
} | } | ||
− | public int returnC() | + | public int returnC(){ |
− | |||
return c; | return c; | ||
} | } |
Latest revision as of 22:58, 2 February 2011
Guide Line
- To create a java class, right click on the package we created earlier (firstAPP) then highlight "New" and scroll down to "Class"
- Under the name text box, enter "Lab1" and click on the button "Finish"
- Copy and paste the following code
package firstAPP; public class LabExercise1 { public int c; public LabExercise1(){ c=4; } public void printHello() { System.out.println("Hello"); } public int returnC(){ return c; } }
- We will be using this sample code as we continue with this tutorial
- Click Here to progress with the tutorial