Java Classes & Objects

Java Classes & Objects

Assessment

Flashcard

Computers

University

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

3 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Predict the output of following Java program?
class Test {
int i;
}
class Main {
public static void main(String args[]) {
Test t;
System.out.println(t.i);
}
}

Back

Compiler Error

2.

FLASHCARD QUESTION

Front

Predict the output of following Java program: class Test { int i; } class Main { public static void main(String args[]) { Test t = new Test(); System.out.println(t.i); } }

Back

0

3.

FLASHCARD QUESTION

Front

Given that Student is a class, how many reference variables and objects are created by the following: Student studentName, studentId; studentName = new Student(); Student stud_class = new Student();

Back

Three reference variables and two objects are created.