What would be the Output

public class Main 
{	
  static
  {
    System.out.println("My Name is Mugil");
  }
}

OP: My Name is Mugil
followed by exception in Main

public class Main 
{	
  static
  {
    System.out.println("My Name is Mugil");
  }
	
  public static void main(String args[])
  {
    {
      System.out.println("What is your Name");	 
    }
  }
}

OP: My Name is Mugil
What is your Name

public class Main 
{	
  public static void main(String args[])
  {
    {
      System.out.println("What is your Name");
    }
   }
}

OP: What is your Name

4.What is the order they are processed

public class Main 
{	
 public static void main(String args[])
 {
   {
     ClassA objA = new ClassA();
     System.out.println("What is your Name"); 
   }
 }
}

class ClassA 
{
  static
  {
    System.out.println("I am in ClassA Static");
  }
	
  ClassA()
  {
    System.out.println("I am in ClassA Constrctor");  
  }

  {
    System.out.println("I am in ClassA");
  }
}

OP:I am in ClassA Static
I am in ClassA
I am in ClassA Constrctor
What is your Name

Static blocks are initiated at first followed by Constructor followed by classA and content in empty class.

5.How to Use Object to invoke function in Class

public class Main2
{
 public static void main(String args[])
 {	
   new A().showName();
 }
}

class A 
{
  public void showName()
  {
    System.out.println("Hi there");
  }
}

OP : Hi there

6.How to Find Class of object

  public class Main3 
  {
   public static void main(String[] args) 
   {
     ClasB objB = new ClasB();
     
     if(objB instanceof ClasB)
     {
       System.out.println(objB.getClass().getName());	
     }		
    }
  }

  class ClasB
  {	
  }

Toggle Class does not work by the way you think

.ClassA
{        
  color : green;
}

.ClassB
{
  color : red;
}
 $('document').ready(function(){
   $('.ClassA').on('click', function(){
      alert($(this).attr('class'));
      $(this).toggleClass('ClassB')
   }); 
 });
<div>Class A</div>
<div>Class B</div>

After the first Time ClassA is Applied When you click ClassA both ClassA and ClassB will be applied to the same tag.

The alert message will display output some thing link ClassA ClassB

Final Modifier Assures that a Reference variable cannot be referenced to a different Object

 public class Main 
 {	
   public int Age;
   public static void main(String args[])
   { 	
     final Main objMain = new Main();
     Main objMain2 = new Main();
     objMain = objMain2;
   }	
 }

OP:Generates a Exception
The final local variable objMain cannot be assigned.

How to find Length of Array

public class Main 
{
  public static void main(String args[])
  {
    int[] a = {1,2,3,4,5};
    System.out.println("Length of array " + a.length);
  }
}

Two Dimensional Array – Java

  class Main
  {
    public static void main(String args[])
    {
      int[][] a = {{1,2}, {3,4}};
      System.out.println("Content of array " + a[0][1]);     
      System.out.println("Length of array " + a[0].length);
    }
  }

OP: Content of array 2
Length of array 2

public class Main11
{
public static void main(String args[])
{
String[] arrName = new String[5];
int[] arrAge = {21, 25, 24, 26, 27};
char[] arrSection = {'A', 'B', 'C', 'D', 'E'};

arrName[0] = "Mugil";
arrName[1] = "Vinu";
arrName[2] = "Madhavan";
arrName[3] = "Adhavan";
arrName[4] = "Suryan";

//Method 1
for(int i=0;i<arrName.length;i++)
{
if(arrName[i] != null)
System.out.println(arrName[i]);
}

//Method 2
//For - Each Method
for(String item : arrName)
{
System.out.println(item);
}

//Method 3
int j =0;
while(j<arrAge.length)
{
System.out.println(arrAge[j]);
j++;
}

//Method 4
int k=0;
do
{
System.out.println(arrSection[k]);
k++;
}while(k<arrSection.length);
}
}

How to use interface Java

public class Main 
{
   public static void main(String args[])
   {
      BallAttributes objBallAttributes = new BallAttributes();
      RubberBall     objRubberBall     = new BallAttributes();
		
      objBallAttributes.bouncable();
      objRubberBall.moveable();
   }
}

class BallAttributes implements RubberBall, Movable 
{
    public void bouncable()
    {
      System.out.println("I am Bouncing");
    }	
    
    public void moveable()
    {
      System.out.println("I am Moving");
    }	
}

interface RubberBall 
{
    public void bouncable();
}

interface Movable 
{
    public void moveable();
}

How to Switch States in Jquery Between Yes or No

.CrossMe
 {
    background : url(CrossMe.gif) no-repeat;
    cursor     : pointer;
    float      : left;
    height     : 44px;
    width      : 51px;
 }

 .TickMe
 {
    background : url(TickMe.gif) no-repeat;
    cursor     : pointer;
    float      : left;
    height     : 44px;
    width      : 49px;
 }

 .NotInterested
  {
    background : url(NotInterested.gif) no-repeat;
    cursor     : pointer;
    float      : left;
    height     : 44px;
    width      : 241px;
  }

 .Interested
 {
    background : url(IamInterested.gif) no-repeat;
    cursor     : pointer;
    float      : left;
    height     : 44px;
    width      : 243px;
 }

Jquery to Change Class

$('document').ready(function(){             
    $('.CrossMe').click(function(){
        $(this).toggleClass('TickMe');

        var prevClass = $(this).prev().attr('class');
        if(prevClass=='Interested')
        {
          $(this).prev().removeClass('Interested').addClass('NotInterested');
        } 
        else
        {
          $(this).prev().removeClass('NotInterested').addClass('Interested');
        }
    });
});

HTML to create divs

  

What is Shell?

Computer understand the language of 0’s and 1’s called binary language.In eaarly days of computing, instruction are provided using binary language, which is difficult for all of us, to read and write. So in Os there is special program called Shell. Shell accepts your instruction or commands in English (mostly) and if its a valid command, it is pass to kernel.

Shell is a user program or it’s environment provided for user interaction. Shell is an command language interpreter that executes commands read from the standard input device (keyboard) or from a file.

Shell is not part of system kernel, but uses the system kernel to execute programs, create files etc.

Several shell available with Linux including:Bash, CSH, KSH, TCSH

To Find the list of Shells available in your system Type the below in your terminal

  cat  /etc/shells

Any of the above shell reads command from user (via Keyboard or Mouse) and tells Linux Os what users want.

To find the current shell you are using now use the below command

 echo $SHELL

what is Shell script?

Shell Script is series of command written in plain text file. Shell script is just like batch file is MS-DOS but have more power than the MS-DOS batch file.