| 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 4 students
Undeclared Variable Error
< Prev
Next >

What error prevents this code from compiling?

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

The variable ‘age’ is used without being declared.

B

There is an extra semicolon in the code.

C

The class declaration is missing the public keyword.

D

The main method is missing a String array parameter.

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
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
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy