How to call Static Method in Another Package
Sample4.java

package com.scjp.test;

public class Sample4 
{
  public static void CallMe()
  {
   System.out.println("I am Static in Another Package");	
  }

  public static void main(String[] args) 
  {	
  }
}

Sample6.java

import com.scjp.test.*;

public class Sample6 
{
  public static void main(String[] args) 
  {
    Sample4.CallMe();
  }
}

Method name same as Class Name
void Sample3 is a method not a Constructor

package com.scjp.test;

public class Sample3 
{	
	void Sample3()
	{
		System.out.println("I am Constructor");
	}
	public static void main(String[] args) 
	{
		Sample3 objSample3 = new Sample3();
	}
}

OP:

Overloading Constructors

package com.scjp.test;

class Sample3
{
  public static void main(String args[])
  {
    Vasko objVasko1 = new Vasko(54);
    Vasko objVasko2 = new Vasko();
    System.out.println(objVasko1.Size);
    System.out.println(objVasko2.Size);
  }	
}

class Vasko
{
   int Size;

   Vasko()
   {	  
   }
	
   Vasko(int s)
   {
    Size = s;	  
   }
}

OP:

54
0

Install Apache Server in Terminal CentOS

 yum install httpd

Check Status of Apache Server

/etc/init.d/httpd status

Start Apache Server

/etc/init.d/httpd start

Start MySQL Terminal

/etc/init.d/service mysqld start

Check Status of MySQL

/etc/init.d/service mysqld status

Javascript Code
Please Note – this doesnt work with old version of js File


$('document').ready(function(){
$('#cboCity').live("change", function(){
alert('Hi there');
});

$('#btnChange').on("click", function(){
changeCities();
});
});

function changeCities()
{
strSelect = "<select id='cboCity' name='cboCity'><option>Chennai</option><option>Mumbai</option></select>";
$('#City').html(strSelect);
}

HTML Code

<input id="btnChange" type="button" name="btnChange" value="Change Me" /></pre>
<table>
<tbody>
<tr>
<td>
<div id="City">
<select id="cboCity" name="cboCity"><option>Chennai</option><option>Mumbai</option><option>Delhi</option><option>Kolkatta</option><option>Andrapradesh</option>
</select>

</div>
</td>
</tr>
</tbody>
</table>

Table Structure

 CREATE TABLE Areas(AreaName VARCHAR(255),
                    PinCode VARCHAR(255))
                    
INSERT INTO Areas(AreaName, PinCode)
          VALUES('Teynampet',   '6000018'), 
                ('Ramapuram',   '6000089'),
                ('TNagar',      '6000017'), 
                ('Mylapore',    '6000014'), 
                ('Gopalapuram', '6000087')

Procedure which returns multiple result sets

 DROP PROCEDURE IF EXISTS mp_test1;
 CREATE PROCEDURE mp_test1()
 BEGIN
   SELECT AreaName FROM Areas;
   SELECT PinCode FROM Areas; 
 END 

Procedure Call

 CALL mp_test1()

PHP Code To retrieve Records from Multiple Resultsets

   $mysqli	= new mysqli('localhost', 'root', '', 'test','3306');
	
   $query = "CALL mp_test1()";
	
   $i = 0;	
	
   if ($mysqli->multi_query($query)) 
   {
    do {		
	/* store first result set */
        if ($result = $mysqli->use_result()) 
	{
	  $j = 0;
	  
          while ($row = $result->fetch_row()) 
	  {
	     $arrResult[$i][$j] = $row[0];
	     $j++;
	  }
				
   	  $result->close();
         }
			
	if($mysqli->more_results()) 
	{
  	  $i = $i + 1;
	}			 
     } while ($mysqli->next_result());
   }
	
   print "
";
   print_r($arrResult);

Table Structure

CREATE TABLE Areas(AreaName VARCHAR(255),
                    PinCode VARCHAR(255))
                    
INSERT INTO Areas(AreaName, PinCode)VALUES
                 ('Teynampet', '6000018'), 
                 ('Ramapuram', '6000089'),
                 ('TNagar', '6000017'), 
                 ('Mylapore', '6000014'), 
                 ('Gopalapuram', '6000087')

Stored Procedure

DROP PROCEDURE IF EXISTS mp_test;
CREATE PROCEDURE mp_test(IN pArea VARCHAR(255))
   BEGIN
      SET @Query = '';
      SET @City  = '';
      SET @Query = 'SELECT PinCode FROM Areas';

      IF pArea != '' THEN
         SET @City = CONCAT(' WHERE AreaName = "', pArea, '"');
      END IF;
      
      SET @Query = CONCAT(@Query, @City);

 PREPARE stmt FROM @Query;
 
 EXECUTE stmt;
 DEALLOCATE PREPARE stmt;  
END