Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 5: Writing Classes
Start Practice TestPractice Test
About Exam
easy Solved by 5 students

Undeclared Variable Error

Mark
< Prev
Next >

What is the compile-time error in the Person class shown below?

public class Person {
    public static void main(String[] args) {
        age = 30;
    }
}
A

There is an extra semicolon in the code.

B

The main method is missing a String array parameter.

C

The variable ‘age’ is used without being declared.

D

The class declaration is missing the public keyword.

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1sgarv251311 0m 00s 100
#2kaisuki11 0m 00s 100
#3bommasam00011 0m 17s 83
#4zgj0731041711 0m 59s 41
Items per page:
10
1 – 4 of 4

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|