| 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 18 students
Static Vs Instance Method Calls
< 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 alpha

B

Alpha alpha

C

Alpha beta

D

Beta 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
Time
Score
#1songqiuhui201211 0m 10s 90
#2patrickmeijer00911 0m 20s 80
#3geethasailaja12 0m 41s 49
#4leftoverjluck12 0m 41s 49
#5parth.taur22711 1m 28s 12
#6y.seong202712 1m 24s 6
#7znasibli101 0m 00s -10
#8kazvin.tjakradinata01 0m 19s -29
#9701704613 2m 05s -45
#1010818526512 2m 25s -55
Items per page:
10
1 – 10 of 13
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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