What does the following code do(explain)?
a) Cinema cinema= new Cinema(4, 13, “5”);
b) System.out.println(100%3);
c) currentRoom.setWallColor(color);
a. Creating object for the class Cinema
Here cinema is the object name
The parameters 4,13,"5" are the constructor parameters .it will call the respective constructors in the Cinema class
B.
%always gives remainder
Output for the statement is 1
100 when divided by 3 produces a remainder of 1
C
Here currentRoom is the object
Color is a parameter it may be any one like red, green, blue etcc
It sets the respective color for the object
Get Answers For Free
Most questions answered within 1 hours.