ITP 120 QUIZ 8
How much space int and long take in RAM?
4 and 8 bytes
What is a constructor?
A constructor is a special method that is used to create an object out of a class definition.
You are given a class LeCar. How do you create an instance of this class?
LeCar myCar=new LeCar();
What is OOP?
Object Oriented Programming
How do you declare variable that holds text?
String str;
What does "static" mean in main() header: public static void main(...)?
That you don't have to create an object to execute main()
What does "static" mean for a method, when placed in a method header before the name?
The method is called straight from a class
Java source code is compiled to Bytecodes which then are interpreted by using JVM or Java Virtual Machine
True
Members of a class are usually made private
True
Java is case sensitive
True The identifier NUMBER is not the same as number.
What does the word reference mean in Java?
address in RAM where the object is set
How do you declare a variable that holds a character?
char a;
To call a regular (non-static) method you need first to _______
create an object
What datatypes can hold 3.456?
double
How do you declare a variable?
double a, b;
How do you declare a variable?
double a,b;
Public class Circle should be saved in a file called Java.exe as your source code
false
You can create a variable with the same name as a reserved keyword such as "else"
false
What is another name for a member variable of a class?
instance of a class
Which one in the following is a typecast?
int a=(int)b;
How many public classes can you have in a file?
just one with the same name as the file
What datatype you would need for 3,445,456,567?
long
What does "void" mean in front of a method name?
method does not return a value
How do you assign a string "Jack" to a variable name?
name="Jack";
To call a method directly from a class, a method needs to be
public static
Constructor never returns any value
true
In Java there are some reserved keywords such as return, for, while, else etc.
true
You can have any number of classes in same file but only one can be declared as public class
true
If a method does not return anything, you have to write in front of it _____
void