Example of nested Switch

public class NestedSwitch {
     public enum subject {dbms, csa};
    public static void main(String[] args) {
        int year=4;
        char branch ='c';
        subject [] s =subject.values();
     
     
// first switch statement

      switch (year)
        {
            case 1 :
                System.out.println("year 1");
                break;
            case 4:
                System.out.println("its 4th year");
             

// 2nd Switch statement
     switch  (branch){
                    case 'm':
                        System.out.println("its mechanical");
                        break;
                       
                    case 'c':
                        System.out.println("Its cse and its top subject are ");
                     
                        for(subject s1:s){ //for enhanced loop of enum
                           
                       
       //3rd switch statement           
            switch (s1)
                        {
                            case csa:
                                System.out.println("csa");
                                break;
                            case dbms:
                                System.out.println("dbms");
                                break;
                                default:
                                    System.out.println("no subject");
                        }
                        }
                       
                       
               break;
                    default :
                        System.out.println("check your branch");
                }
                break; // caution to put break here
            default:
                System.out.println("check your year");
        }
       
    }
   
   
}






                        output

its 4th year
Its cse and its top subject are
dbms
csa

Different uses of loop

public class LoopClasses {
static int i=5;
   
    public static void main(String[] args) {

// while infinite loop

      while(true)  {
          System.out.println("the value of i is "+i);
      }


*********************************************************************************
     //do while infinite loop

       do {           
            System.out.println(" "+i);
        } while (true);

       
*********************************************************************************       // use of break statement

 do {   
            i++;
            System.out.println(""+i);
            break;  // use of break
        } while (i<10);

*********************************************************************************


// labeled for loop
aa:

        for (int j = 0; j < 10; j++) {
            System.out.println(" "+j);
            for (int k = 0; k < 10; k++) {
                if(j==k)
                {
                  break aa;
                 
                }
            }
        }
System.out.println(" i am out aa");

*********************************************************************************
//use of continue statement

          for (int j = 0; j < 5; j++) {
             
              if (j==3) {
               continue; // when j==3 it redirect back to for loop and do not let it go to print j value at 3
                 //  System.out.println("ok "); unreachable
              }
             
              System.out.println(" "+ j);
        }



*********************************************************************************
// java for each loop

int ar[] = {2,3,4,5};

for(int i:ar)
{
    System.out.println(" "+i);
}


*********************************************************************************
//for infinite loop

        for (;;) {
            System.out.println("sj");
        }




    }
   
}

Use of inner class

public  class  UseOfInnerClass {
static int d=5;
  static  class  inner {
        void msg(){
            System.out.println("i am in inner class " +d); // for accessing d the classs is made static        //because static variable can be acessed by static class only
        }
    }
   
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
     
     UseOfInnerClass.inner ob =new UseOfInnerClass.inner(); // calling method of inner class
        ob.msg();
}
}


output

i am in inner class 5

The power decision



This  is the story of a boy who was exceptional, but he in order to maintain his family tradition he sacrificed his physical pleasure.

He could not decide what to do and what not.
He remained confused and this confusion continued in his other walks of life.

After a long time, a twist came in his life. He started destroying himself in love toward a girl who has no emotion for him. He did not value his self-esteem against her.

He made the mistake of prioritizing her and de-prioritizing all works of life.
He was having full confidence in his skills that one day he will back up all mistakes of life.
But he did not do that at "right time" and as a result, he loses his self-esteemed once again at a place where he desires to be respected.

The point I am making for that boy because he has not taken the right decision at right time.
Like that there are many people who do the same mistake.
For someone, it comes out of lust and for someone it comes out of greediness.
The title is justified as one has to take the right decision at right time in life and after that time he again has to take some right decision to get the pleasure of life.

The one who does both enjoy the life ...but he also needs to keep patience.









A tribute

A real tribute lies in doing all the work for enhancing your family.