Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
hard Solved by 17 students

Static Vs Instance Method Calls

Mark
< Prev
Next >

What is printed as a result of executing the following code segment?

class Alpha {
    static String staticMethod() { return "Alpha"; }
    String instanceMethod() { return "alpha"; }
}
class Beta extends Alpha {
    static String staticMethod() { return "Beta"; }
    String instanceMethod() { return "beta"; }
}
public class Test {
    public static void main(String[] args) {
        Alpha a = new Beta();
        System.out.print(a.staticMethod() + " " + a.instanceMethod());
    }
}
A

Beta beta

B

Alpha alpha

C

Beta alpha

D

Alpha beta

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
#1songqiuhui201211 0m 10s 90
#2zhenmunse12 0m 04s 86
#3Wilbert.Ankomah2711 0m 17s 83
#4patrickmeijer00911 0m 20s 80
#5geethasailaja12 0m 41s 49
#6leftoverjluck12 0m 41s 49
#7muhammadmuso43211 0m 53s 47
#8parth.taur22711 1m 28s 12
#9y.seong202712 1m 24s 6
#10znasibli101 0m 00s -10
Items per page:
10
1 – 10 of 20

AI Tutor

How can I help?

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