CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Constructor and Fields

Java quiz · Question 23
mediumClasses

What is printed?

Code

1class Box {
2 private int size;
3 
4 public Box(int size) {
5 size = size;
6 }
7 
8 public int getSize() {
9 return size;
10 }
11}
12 
13public class Main {
14 public static void main(String[] args) {
15 Box b = new Box(7);
16 System.out.println(b.getSize());
17 }
18}