Knowee
Questions
Features
Study Tools

Select the correct answerIf the code executes fine then predict the correct output otherwise choose the suitable option.class Code {    public void showTime() {       System.out.println("657");    }}  class Tantra extends Code {    public void showTime() {       System.out.println("-405");    }}  public class Main {    public static void main(String[] args) {        Code b = new Tantra();        b.showTime();    }}Options-405657error: showTime() in Tantra cannot override showTime() in Code657-405-405657

Question

Select the correct answerIf the code executes fine then predict the correct output otherwise choose the suitable option.class Code {    public void showTime() {       System.out.println("657");    }}  class Tantra extends Code {    public void showTime() {       System.out.println("-405");    }}  public class Main {    public static void main(String[] args) {        Code b = new Tantra();        b.showTime();    }}Options-405657error: showTime() in Tantra cannot override showTime() in Code657-405-405657

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

-405

Similar Questions

Select the correct answerDecode the code and choose the correct results: abstract class A { final void showTime() { System.out.println("3900"); } } class B extends A {   static void funTime() {     System.out.println("7766");   } } public class Main { public static void main(String args[]) { A object = new B(); object.showTime(); B.funTime(); } }Options7766390077667766Error3900390039007766

he correct answerAssuming that all the necessary imports are done, predict the output of the given Java Program. class Code {    public Code(String s) {        System.out.print("Code");    } }   public class Tantra extends Code {    public Tantra(String s) {        System.out.print("Tantra");    }    public static void main(String[] args) {         new Tantra("Company");        System.out.println(" ");    } }OptionsCodeCodeTantraCompanyTantraCompilation fails

Select the correct answerWhat will be the output of the following Java code?class Code{ Code()throws IOException {  }  }class Tantra extends Code{ Tantra() {  } public static void main(String[]args) {  }}Optionscompile and runs finerun time errorcompile time errorunreported exception java.io.IOException in default constructor

Select the correct answerWhat will be the output of the following Java code? class newthread extends Thread { Thread t; newthread() { t = new Thread(this,"New Thread"); t.start(); } public void run() { System.out.println(t.isAlive()); } } class Code_Tantra { public static void main(String args[]) { new newthread(); } }Optionstrue10false

Select the correct answerWhat will be the output of the following Java code? class overload   {    int Code;  int Tantra;    void add(int x)     {      Code = x + 1;    }    void add(int x, int y)    {      Code = x + 2;    }       }     class Overload_methods   {    public static void main(String args[])    {      overload obj = new overload();        int Code = 0;      obj.add(6);      System.out.println(obj.Code);       }  }Options7658

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.