2020 assesment Flashcards
Classify and List any 6 of the java primitive data types as numerics and non-numerics
Numerics (Int, byte, short, long) , Non-numerics ( char, Boolean)
Define Declaration
A declaration statement associates a variable name with a type at compile time.
Ie. Int i= 0;
define an identifier
*We use identifiers to name variables (and many other things) in Java.
i.e int a; int refers to data type, a is an identifier which is the name of the variable
Define a literal
A literal is a source-code representation of a data-type value.
99 is a literal of type int .
Define an expression
An expression is a literal, a variable, or a sequence of operations on literals and/or variables that produces a value.
e.g
* Int a= I + 1 is an expression
c) Write a java program which prints the string hello world I am a new java programme
Write a java program which prints the string hello world I am a new java programme
Public class HelloWorld {
System.out.print.out(“ hello world”);
}
2 marks for correct class header, 2 marks for a print statement
In Java programming language what does statement statically-typed mean?
which means that all variables must first be declared before they can be used.
b) Explain the difference between an object and a class in Java
Class: A template that defines the properties (variables) and behavior (methods) of objects.
Object: An instance of a class that holds specific values for the properties defined in the class.