• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java overloading question

Bluga

Banned
Given:

1. public class ConstOver {
2. public ConstOver (int x, int y, int z) {
3. }
4. }

Which two overload the ConstOver constructor? (Choose Two)
A. ConstOver ( ) { }
B. Protected int ConstOver ( ) { }
C. Private ConstOver (int z, int y, byte x) { }
D. Public Object ConstOver (int x, int y, int z) { }
E. Public void ConstOver (byte x, byte y, byte z) { }

Answer: A, C?

why B, E are incorrect? There shouldn't be constraint on the accessbility, retrun type, or exceptions that may be thrown on oveloading method right?

 
Originally posted by: Bluga
Given:

1. public class ConstOver {
2. public ConstOver (int x, int y, int z) {
3. }
4. }

Which two overload the ConstOver constructor? (Choose Two)
A. ConstOver ( ) { }
B. Protected int ConstOver ( ) { }
C. Private ConstOver (int z, int y, byte x) { }
D. Public Object ConstOver (int x, int y, int z) { }
E. Public void ConstOver (byte x, byte y, byte z) { }

Answer: A, C?

why B, E are incorrect? There shouldn't be constraint on the accessbility, retrun type, or exceptions that may be thrown on oveloading method right?

Remember -- a constructor always has the same name as the class it's in and also has no return value. A and C are the only functions in the list that don't have a return type.
 
Back
Top