keyword that creates a new instance of an object
new
MUST BE ABLE TO EXPLAIN WHY:
A=true B=true C = false
boolean D = (A||B && C )
System.out.println(D)
false
int x = 0
while (x<10){
x++;
}
how many times will the while run(condition evaluated to "true")?
10
int x = (double) 5;
compile incompatible types
whats my fav color
blue
can be accessed by other classes
public
A=true B=false
boolean c = !(A||B)
System.out.println(c);
true
for(int x = 5; x>0; x++){
System.out.println(x);
}
infinite loop!!!
System.out.println(4/0);
String c;
System.out.println(c)
compile time
nullpointerexception - c is not initialized
Which city do my parents live in
Johannesburg
we check to see if something is true name all 4 keywords that do this (loops too)
for , while , if , else if
boolean c = (3.0 >= 4.0) || !(true || false)
false
int b = 18 - (8.5*2);
b = a + b?
10
System.out.println(4/0);
runtime error due to division by 0 = NaN
arithmeticexception
What sports do I coach at CDS since august till now
Volleyball , Swimming
no return value
void
boolean c = !(4=>5)
true, new cond is (4<5) by using demorgans law
double a = (int) 5.5 + 4;
int b = 18 - (8.5*2);
b = a + b?
error double cannot go into int
String awesomeSauce = "samsung";
int q = awesomeSauce.indexOf("i");
System.out.println(awesomeSauce.substring(q,q+1);
runtime - indexoutofbounds
indexof will return -1 there is no i
What was my first car?
Blue VW Beetle
static
does not need an instance of a class to be called and can be modified by all methods of the class with effects that last
x=0
a=2
boolean c = (x!=0) &&((3.0*4 == 7*x)&&(4.0*2!=16/2 && 4/2=a*(int) Math.random())
false
String str = "racecar";
for(int i = str.length()-1; i > -1; i--){
System.out.print(str.substring(i,i+1);
}
racecar
public int mystery(){
int x = 100;
if (x>10){
x++;
mystery(x)
}
return 1
}
runtime error due to infinite recursion
stackoverflowerror
How many siblings do I have?
one younger but big brother