Basic Java Language: Difference between revisions
wikademia>Mystictim add learning activities category |
|||
| Line 2: | Line 2: | ||
=Touch on Classes= | =Touch on Classes= | ||
Everything in Java is done inside classes. Classes are bodies of statements, methods, and variables. A statement can be thought of as the smallest standalone element of an imperative programming language (or a language that explicitly specify an algorithm to achieve a goal, opposed to declarative programming, which explicitly specifies a goal and leaves the implementation of that goal to algorithms within the support software). A program is formed by a sequence of one or more statements (e.g. if x, then y). A statement will have internal components (e.g. expressions). A method usually consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly an output value (called return value) of some kind. There is a method called main that all classes have. This is the start point of your program - where everything must begin. To create a class, the syntax (or basic outline in code) is: | Everything in Java is done inside classes. Classes are bodies of statements, methods, and variables. A statement can be thought of as the smallest standalone element of an imperative programming language (or a language that explicitly specify an algorithm to achieve a goal, opposed to declarative programming, which explicitly specifies a goal and leaves the implementation of that goal to algorithms within the support software). A program is formed by a sequence of one or more statements (e.g. if x, then y). A statement will have internal components (e.g. expressions). A method usually consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly an output value (called return value) of some kind. There is a method called main that all classes have. This is the start point of your program - where everything must begin. To create a class, the syntax (or basic outline in code) is: | ||
<pre> | <pre> | ||
| Line 20: | Line 22: | ||
</pre> | </pre> | ||
This, essentially creates a class. All the code goes between { and }. | This, essentially creates a class. All the code goes between { and }. | ||
==a subsection == | |||
This is some sample text in my subsection. | |||
=Protection= | =Protection= | ||