What is the output?
String test = "abcdefg";
System.out.println(test.substring(3));
Give this one a try later!
defg
,What is the output of page 11 on exam2reviewquestion?
Give this one a try later!
108.0
What sort of value does x store if x is a string?
Give this one a try later!
The value of x is a memory address
How would you call a constructor from another constructor in the same class?
Give this one a try later!
If you were trying to call a constructor with three parameters you could
write: "this(initialName,0 ,0);". This line has to be called at the beginning of
the constructor's body.
What is the difference between formal and actual parameters?
Give this one a try later!
, Formal parameters are the parameters that are in the method's heading and
actual parameters are the parameters that are entered when the method is
called.
What is the output?
for(int i = 10; i> 100; i++)
{
int x = i*i;
}
Give this one a try later!
Nothing because i is not greater than 100
Can a static method call a non-static method?
Give this one a try later!
No. A static method can't call a non-static method unless it has an object to
do so.
What is another way to write
for (String i : words)?
Give this one a try later!
, for (int i = 0; i < words.length; i++)
When will Java not define a default constructor for you?
Give this one a try later!
Java won't create a default constructor for you if you make any kind of
constructor (with or without parameters) for the class
What is the difference between calling a public method vs calling a public static
method?
Give this one a try later!
for public methods (non-static) you would type
object_Name.method_Name() and for a public static method you would
type class_Name.method_Name()
What is the output?
double[] x = {7.2, 6 , 2, 5.7, 0, 99, 108, 66};
System.out.println(x[8]);
Give this one a try later!
This would be an error
String test = "abcdefg";
System.out.println(test.substring(3));
Give this one a try later!
defg
,What is the output of page 11 on exam2reviewquestion?
Give this one a try later!
108.0
What sort of value does x store if x is a string?
Give this one a try later!
The value of x is a memory address
How would you call a constructor from another constructor in the same class?
Give this one a try later!
If you were trying to call a constructor with three parameters you could
write: "this(initialName,0 ,0);". This line has to be called at the beginning of
the constructor's body.
What is the difference between formal and actual parameters?
Give this one a try later!
, Formal parameters are the parameters that are in the method's heading and
actual parameters are the parameters that are entered when the method is
called.
What is the output?
for(int i = 10; i> 100; i++)
{
int x = i*i;
}
Give this one a try later!
Nothing because i is not greater than 100
Can a static method call a non-static method?
Give this one a try later!
No. A static method can't call a non-static method unless it has an object to
do so.
What is another way to write
for (String i : words)?
Give this one a try later!
, for (int i = 0; i < words.length; i++)
When will Java not define a default constructor for you?
Give this one a try later!
Java won't create a default constructor for you if you make any kind of
constructor (with or without parameters) for the class
What is the difference between calling a public method vs calling a public static
method?
Give this one a try later!
for public methods (non-static) you would type
object_Name.method_Name() and for a public static method you would
type class_Name.method_Name()
What is the output?
double[] x = {7.2, 6 , 2, 5.7, 0, 99, 108, 66};
System.out.println(x[8]);
Give this one a try later!
This would be an error