1. What will be the output of the program? Float f = new Float("12"); switch (f) { case 12: System.out.println("Twelve"); case 0: System.out.println("Zero"); default: System.out.println("Default"); }





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    The switch statement can only be supported by integers or variables more "narrow" than an integer i.e. byte, char, short. Here a Float wrapper object is used and so the compilation fails.
Show Similar Question And Answers
QA->What the twelve constellations to as zodiac?....
QA->A semiconductor device used to amplify or switch electronic signals and electrical . power?....
QA->Name the translatory program which translates the high level language into machine language before running the program?....
QA->What minimum number of non-zero non-collinear vectors is required to produce a zero vector?....
QA->The minimum number of non-zero non-collinear vectors required to produce a zero vector is?....
MCQ->What will be the output of the program? Float f = new Float("12"); switch (f) { case 12: System.out.println("Twelve"); case 0: System.out.println("Zero"); default: System.out.println("Default"); }....
MCQ->Which two cause a compiler error? float[ ] f = new float(3); float f2[ ] = new float[ ]; float[ ]f1 = new float[3]; float f3[ ] = new float[3]; float f5[ ] = {1.0f, 2.0f, 2.0f};....
MCQ->What will be the output of the program? class Happy extends Thread { final StringBuffer sb1 = new StringBuffer(); final StringBuffer sb2 = new StringBuffer(); public static void main(String args[]) { final Happy h = new Happy(); new Thread() { public void run() { synchronized(this) { h.sb1.append("A"); h.sb2.append("B"); System.out.println(h.sb1); System.out.println(h.sb2); } } }.start(); new Thread() { public void run() { synchronized(this) { h.sb1.append("D"); h.sb2.append("C"); System.out.println(h.sb2); System.out.println(h.sb1); } } }.start(); } }....
MCQ->What will be the output of the following program? #include<iostream.h> int main() { float Amount; float Calculate(float P = 5.0, int N = 2, float R = 2.0); Amount = Calculate(); cout<< Amount << endl; return 0; } float Calculate(float P, int N, float R) { int Year = 1; float Sum = 1 ; Sum = Sum (1 + P ++N R); Year = (int)(Year + Sum); return Year; }....
MCQ->What will be the output of the C#.NET code snippet given below? char ch = Convert.ToChar ('a' | 'b' | 'c'); switch (ch) { case 'A': case 'a': Console.WriteLine ("case A | case a"); break; case 'B': case 'b': Console.WriteLine ("case B | case b"); break; case 'C': case 'c': case 'D': case 'd': Console.WriteLine ("case D | case d"); break; }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution