Why will the code not compile?

Given:
<code>
public class Basic {
private static int letter;
public static int getLetter();
public static void Main(String[] args) {
System.out.println(getLetter());
}
</code>
Why will the code not compile?

Given:

public class Basic {
private static int letter;
public static int getLetter();
public static void Main(String[] args) {
System.out.println(getLetter());
}

Why will the code not compile?

A.
A static field cannot be private.

B.
The getLetter method has no body.

C.
There is no setletter method.

D.
The letter field is uninitialized.

E.
It contains a method named Main instead of ma

Explanation:

The getLetter() method needs a body public static int getLetter() { }; .



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Carlos

Carlos

this test don´t work, I failed the test, Don´t lost your time. Only 5 quest are in the test