Sunday, July 20, 2014

Switch program in java

  Test Switch problem in java..
        class TestSwitch
       {
            public statitc void main(String args[])
               {
                      int i=1,j=0;
                   switch(i)
                     {
                         case 2: j+=2;
                         case 3: j+=4;
                         default: j+=0;
                        case 0: j+=2;
                  }
             System.out.println("The Value of J="+j);
         }
   }

The out is  2
   bexoz default is used anywhere in switch...




No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...