Basic Java Language: Difference between revisions
wikademia>Cremisis13 |
wikademia>Cremisis13 →Protection: Addition of clarification |
||
| Line 46: | Line 46: | ||
|} | |} | ||
</center> | </center> | ||
"class it is in" means the class that you have created using <code>public class NAME</code>. You will learn about packages later, but essentially they are a package of related code (classes). "Subclass" is that it can be accessed from any class that extends it (see Inheritance). | |||
=Statements= | =Statements= | ||
All calculations are done in statements. Every statement ends in a semicolon: ;. Statements can set a variable with the '=' operator. This sets the variable you wish to set to another variable or a value. Values can only be used on primitive types. As you saw in the HelloWorld program, there was one statement: <code>System.out.println("Hello, World")</code>. This is one type of statement called calling a method. More will be discussed later. Finally, you can declare a variable. If a class has no statements, it would do nothing. | All calculations are done in statements. Every statement ends in a semicolon: ;. Statements can set a variable with the '=' operator. This sets the variable you wish to set to another variable or a value. Values can only be used on primitive types. As you saw in the HelloWorld program, there was one statement: <code>System.out.println("Hello, World")</code>. This is one type of statement called calling a method. More will be discussed later. Finally, you can declare a variable. If a class has no statements, it would do nothing. | ||