exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 76 discussion

Actual exam question from Oracle's 1z0-819
Question #: 76
Topic #: 1
[All 1z0-819 Questions]

Given:

public interface ExampleInterface{ }

Which two statements are valid to be written in this interface? (Choose two.)

  • A. public String methodD();
  • B. public int x;
  • C. final void methodG(){
    System.out.println("G");
    }
  • D. final void methodE();
  • E. public abstract void methodB();
  • F. public void methodF(){
    System.out.println("F") ;
    }
  • G. private abstract void methodC();
Show Suggested Answer Hide Answer
Suggested Answer: AE 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
6 months ago
Selected Answer: AE
answer :AE Interface attributes are by default public, static, final Constants must be set to a value
upvoted 1 times
ASPushkin
1 month, 3 weeks ago
B. not correct Constants must be set to a value within declaration ! initializers not allowed in interfaces public int x = 0;
upvoted 1 times
...
...
bardemk
9 months, 3 weeks ago
Selected Answer: BE
A. Double c = (Double) i; // Inconvertible types; cannot cast 'java.lang.Integer' to 'java.lang.Double B. Double b = Double.valueOf(i); //Ok C. Double a = i; // Required type: Double - Provided: Integer D. double e = Double.parseDouble(i); // Required type: String - Provided: Integer E. double d= i; //Ok
upvoted 1 times
...
d7bb0b2
1 year, 1 month ago
B is invalid because interface only accepts constant that is marked as static and final
upvoted 1 times
...
tmuralimanohar
1 year, 6 months ago
Answer: AE
upvoted 1 times
...
Stavok
1 year, 7 months ago
Selected Answer: AE
A & E are correct TESTED
upvoted 1 times
Stavok
1 year, 5 months ago
In a Java interface, only abstract methods and constants are allowed. Therefore, the two valid statements that can be written in the ExampleInterface are A. public String methodD(); and E. public abstract void methodB();. Both of these statements declare abstract methods, which is allowed in an interface.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago