Question

This is an easy Java question

Which of the following statements are true? public class Main public Main(int i, float f) () public Main(float f, int i) public Main(float f) () public void Main0 ) O A. A syntax error will occur because void cannot be used with a constructor. B. A syntax error will occur because the first two constructors are not unique. C. The class does not have a default constructor D. No syntax errors will be generated. OE. A and C F.C and D

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here, a syntax error will be generated since constructor doesn't have a return type.
So, last constructor is invalid.

Ans is (A)

Add a comment
Know the answer?
Add Answer to:
This is an easy Java question Which of the following statements are true? public class Main...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please this is Java and i need help Question 5 public class Food { public void...

    please this is Java and i need help Question 5 public class Food { public void Foodmethod_1 (int i) { public void Foodmethod_2 (int i) { } public static void Foodmethod_3(int i) { public class Bankudade extends Food { public static void Foodmethod_1 (int i) { public void Foodmethod_2 (int i) { public void Foodmethod_3 (int i) { > 7 a) Determine which method in the subclass overrides a method in the super class? (6 marks) EV b) Determine which...

  • Find the following java program's 9 syntax errors. public class Parameters { public static void main()...

    Find the following java program's 9 syntax errors. public class Parameters { public static void main() { double bubble = 867.5309; double x = 10.01; printer(double x, double y); printer(x); printer("barack", "obama"); System.out.println("z = " + z); } public static void printer(x, y double) { int z = 5; System.out.println("x = " + double x + " and y = " + y); System.out.println("The value from main is: " + bubble); }

  • For Java please.Artwork. javaimport java.util.Scanner;public class ArtworkLabel {public static void main(String[] args)...

     Given main(). define the Artist class (in file Artist java) with constructors to initialize an artist's information, get methods, and a printlnfo() method. The default constructor should initialize the artist's name to "None' and the years of birth and death to 0. printinfo() should display Artist Name, born XXXX if the year of death is -1 or Artist Name (XXXX-YYYY) otherwise. Define the Artwork class (in file Artwork.java) with constructors to initialize an artwork's information, get methods, and a printinfo() method. The constructor should...

  • FIX THE FOLLOWING JAVA CODE public class Errors public static main(String[] args) { float sum int...

    FIX THE FOLLOWING JAVA CODE public class Errors public static main(String[] args) { float sum int a = 27.5, b = 72.99; suma(a, b); System.out.println("Suma = %7:3b", sum); } //end main public static suma(float a, double b) { double suma suma = a + b; } }//end class

  • What is wrong with the following Java Code. public class TestEdible { abstract class Animal {...

    What is wrong with the following Java Code. public class TestEdible { abstract class Animal { /** Return animal sound */ public abstract String sound(); } class Chicken extends Animal implements Edible { @Override public String howToEat() { return "Chicken: Fry it"; } @Override public String sound() { return "Chicken: cock-a-doodle-doo"; } } class Tiger extends Animal { @Override public String sound() { return "Tiger: RROOAARR"; } } abstract class Fruit implements Edible { // Data fields, constructors, and methods...

  • 1. What is the output when you run printIn()? public static void main(String[] args) { if...

    1. What is the output when you run printIn()? public static void main(String[] args) { if (true) { int num = 1; if (num > 0) { num++; } } int num = 1; addOne(num); num = num - 1 System.out.println(num); } public void addOne(int num) { num = num + 1; } 2. When creating an array for primitive data types, the default values are: a. Numeric type b. Char type c. Boolean type d. String type e. Float...

  • Analyze the following code: public class Test { public int x; public Test(String t) { System.out.println("Test");...

    Analyze the following code: public class Test { public int x; public Test(String t) { System.out.println("Test"); public static void main(String[] args) { Test test: System.out.println(test.x); The program has a compile error because Test class does not have a default constructor The program has a compile error because test is not initialized OO The program has a compile error because x has not been initialized The program has a runtime NullPointerException while executing test.x because test is a null reference and...

  • What is the output of following program: public class Test{ public static void main(String[] args) {...

    What is the output of following program: public class Test{ public static void main(String[] args) { A a = new A(): a method B(): } } class A{ public A(){ System out println("A's constructor is executed"): } public void method(){ System out printin ("methodA is executed"): } public void methodAB(){ System out printin ("As methodAB is executed"): } } class B extends A { private int num = 0: public B (){ super(): System out printin ("B's constructor is executed"):...

  • Consider the following codes: public class TestThread extends Thread {     public static void main(String[] args)...

    Consider the following codes: public class TestThread extends Thread {     public static void main(String[] args) {         TestThread thread = new TestThread();     }     @Override     public void run() {         printMyName();     }     private void printMyName() {         System.out.println("Thread is running");     } } Test Stem / Question Choices 1: What method should you invoke to start the thread TestThread? A: start() B: run() C: No. Thread will run automatically when executed. D: TestThread is not...

  • **JAVA*JAVA Question 1 How many k's values will be printed out? public static void main(Stringl args)...

    **JAVA*JAVA Question 1 How many k's values will be printed out? public static void main(Stringl args) for (int k-1: k10:k if (k8) continue: System.out.println k) Question 2 3.5 pts Analyze the following code. Which one is correct? package p public class A package p2: import p1. public class B extends Af int i- 5 private int j- 10: public A0I public static void main(Stringll args) B b new B0: System.out.println(a.i+", "+ajt", "+b.it""+bj): a.i is printable None of them b.i is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT