6 years ago in Java Strings

What will happen if you try to compile and run the following code ?
public class MyClass {

public static void main(String arguments[]) {

}

public void amethod(String[] arguments) {

}

}

[A] error Can't make static reference to void method.
[B] error method main not correct
[C] error array must include parameter
[D] amethod must be declared with String
Loading...
Next Question

Create your Digital Resume For FREE on your name's sub domain "yourname.wcard.io". Register Here!


Overall Stats

Attempted 186
Correct 31
Incorrect 62
Viewed 93

Answers

Guest
Guest
Cristian Budaianu - 4 years ago

code will compile and run without any warning and errors.

Dipesh Rane - 5 years ago

All options are in correct, above code will compile and run without any warning and errors.

Kuheli Mitra
Kuheli Mitra - 4 years ago

Kuheli Mitra from Bangalore, India is saying amethod must be declared with String is correct answer

Dimana Ignatova
Dimana Ignatova - 4 years ago

Dimana Ignatova from Sofia, Bulgaria is saying error Can't make static reference to void method. is correct answer

rupa devi
rupa devi - 4 years ago

rupa devi from United States is saying error Can't make static reference to void method. is correct answer

Related Questions

What is the output of the code ?
public class AQuestion{

      private int i = j;

      private int j = 10;

      public static void main(String args[]){

            System.out.println((new AQuestion()).i);

      }

}

  • [A] Compiler error complaining about access restriction of private variables of AQuestion.
  • [B] Compiler error complaining about forward referencing.
  • [C] No error - The output is 0;
  • [D] No error - The output is 10;