1.5.7.1. Fill-In, Assignment statements.
Solution.
The value 12 is stored in
num
.application program | assignment statement | comment |
compound statement (block) | data type | declaration statement |
default constructor | executable statement | expression |
identifier | literal value | object instantiation |
operator | package | parameter |
primitive data type | pseudocode | qualified name |
semantics | statement | stepwise refinement |
syntax |
int
, boolean
, and double
types.String
("Hello") or an int
(5).
Type VariableName ;
VariableName = Expression ;
int
values (7 + 8
), the \(+\) operation produces an int
result.class
followed by an identifier naming the class followed, optionally, by the keyword extends
and the name of the class’s superclass.new
operator in conjunction with one of the class’s constructors.System.out.print("hello")
uses Java dot notation to invoke the print()
method of the System.out
object..java
extension. A Java bytecode file has the same name as the source file but a .class
extension. It is an error in Java if the name of the source file is not identical to the name of the public Java class defined within the file.num
.int num2 = 0;
public class OldMacDonald
{
public static void main(String args[]) // Main method
{
System.out.println("Old MacDonald had a farm");
System.out.println("E I E I O.");
System.out.println("And on his farm he had a duck.");
System.out.println("E I E I O.");
System.out.println("With a quack quack here.");
System.out.println("And a quack quack there.");
System.out.println("Here a quack, there a quack,");
System.out.println("Everywhere a quack quack.");
System.out.println("Old MacDonald had a farm");
System.out.println("E I E I O.");
System.out.println("Old MacDonald had a farm");
System.out.println("E I E I O.");
System.out.println("And on his farm he had a pig.");
System.out.println("E I E I O.");
System.out.println("With an oink oink here.");
System.out.println("And an oink oink there.");
System.out.println("Here an oink, there an oink,");
System.out.println("Everywhere an oink oink.");
System.out.println("Old MacDonald had a farm");
System.out.println("E I E I O.");
} // End of main
} // End of OldMacDonald
public class Pattern
{
public static void main(String args[])// Main method
{
System.out.println("**********");
System.out.println("* ** ** *");
System.out.println("* ** *");
System.out.println("* * * *");
System.out.println("* **** *");
System.out.println("**********");
} // End of main
} // End of Pattern