User Tools

Site Tools


java:defining_classes_in_java

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
java:defining_classes_in_java [2020/09/12 02:04] mithatjava:defining_classes_in_java [2020/09/12 02:49] – [Our first Java class] mithat
Line 28: Line 28:
 Here's a Java definition for a ''ClickerCounter'' class: Here's a Java definition for a ''ClickerCounter'' class:
  
-<file java ClickerCounter.java>+<code java>
 public class ClickerCounter { public class ClickerCounter {
          
Line 41: Line 41:
     }         }    
 } }
-</file>+</code> 
 + 
 +==== Where does the definition go? ==== 
  
 In Java, class definitions need to go in their own files, and the files need to be called the name of the class with the ''.java'' extension.((There are certain kinds of classes that don't need to be in their own file, but that's something we can't discuss yet.)) I have deliberately not used any comments in the definition so you can more easily see the code. In Java, class definitions need to go in their own files, and the files need to be called the name of the class with the ''.java'' extension.((There are certain kinds of classes that don't need to be in their own file, but that's something we can't discuss yet.)) I have deliberately not used any comments in the definition so you can more easily see the code.
java/defining_classes_in_java.txt · Last modified: 2020/09/14 01:38 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki