Friday, 4 April 2014

Security measures in java control panel

http://www.java.com/en/download/help/jcp_security.xml

http://www.java.com/en/download/faq/security-tips.xml



Refer the above links for Security measures in java control panel

Wednesday, 2 April 2014

JAVA : - More Package Progrmas


Program 1
//create packaddress folder 
// save this program in folder packaddress
package packaddress;

 public class package2 
{

 public  package2(int stno,String stname,String city)
{
System.out.println("Address : "+stno+"  "+stname+"   " +city);

}
public void sal(int bp,int hra,int tax)
{
System.out.println("Basic Pay: "+bp+"HRA : "+hra+"Tax Amount : "+tax);

}
}

// to compile this code use javac packaddress/package2.java

program2
--------------------------------------------------------
// create  student  folder 
// save this program in student folder
package student;
import packaddress.package2;
//import packaddress.*;
import java.io.*;

 public class package1imp 
{
int tot, m1,m2,m3;String stu= new String();String name= new String();
String grade =new String();
public void input()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your score in JAVA subject\n");
stu=br.readLine();
m1=Integer.parseInt(stu);
System.out.println("Enter your score in LINUX subject\n");
stu=br.readLine();
m2=Integer.parseInt(stu);
System.out.println("Enter your score in AI subject\n");
stu=br.readLine();
m3=Integer.parseInt(stu);
tot=m1+m2+m3;
grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}

 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
package2  packadd=new package2(56,"rama","Mumbai");
packadd.sal(12000,1000,2000);

}
}
// to compile this code first compile javac packaddress/package2.java
// because packageaddress package is imported
// next use javac student/package1imp.java 

main program 
/ create studentdetails  folder
// save this program in the folder studentdetails
package studentdetails;
import student.*;
import packaddress.*;
class studpackdemoimp{
public static void main(String[] args)
{
package1imp p1=new package1imp();
p1.input();
p1.printop();
package2 p2=new package2(23,"hema","chennai");


}
}
// to run this code follow the following steps
// create a file package2.java and compile
// create a file package1imp.java and compile
//  to run this program 
//use javac studentdetails/studpackdemoimp.java
// java studentdetails/studpackdemoimp

Tuesday, 1 April 2014

JAVA Programming : Package

Follow the steps for creating package

 1. create a folder called "student"
  2. change to the student folder then create a java file package1.java,package2.java and studentpackdemo.java
3. compilation:
          i)  move out of existing student folder using "cd.."
          ii) to compile use the below code
                  javac student/package1.java
                   javac student/package2.java
                  javac student/studentpackdemo.java

4. to run only the main package which is called studentpackdemo.java
                  java student/studentpackdemo

5. here the codes are given for all the packages

------------------------------------------------------------------------------------
 package student;
class studpackdemo{
public static void main(String[] args)
{
package1 p1=new package1();
p1.printop();
package2 p2=new package2(45,"jack","Madurai");
}
}

 ------------------------------------------------------------------------------------------



 package student;
import java.io.*;

 class package1
{
int tot, m1,m2,m3;
String stu=new String();
String name=new String();
String grade=new String();
public  package1()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your score in JAVA subject\n");
stu=br.readLine();
m1=Integer.parseInt(stu);
System.out.println("Enter your score in LINUX subject\n");
stu=br.readLine();
m2=Integer.parseInt(stu);
System.out.println("Enter your score in AI subject\n");
stu=br.readLine();
m3=Integer.parseInt(stu);
tot=m1+m2+m3;
grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}

 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
}
}


--------------------------------------------------------------------------------------------------

package student;

 class package2
{

 public  package2(int stno,String stname,String city)
{
System.out.println("Address : "+stno+"  "+stname+"   " +city);

}
}
----------------------------------------------------------------------------------------------


JAVA Programming : Inheritance - Interface - examples

import java.io.*;
interface access
{
public int str=54;
public void input();
public void calc();
public void printop();

}abstract class student implements access
{
int tot,fee;String stu=new String();String name=new String();
String grade =new String();
public void input()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
System.out.println("Enter your Semester fees \n");
stu=br.readLine();
fee=Integer.parseInt(stu);grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}


 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
System.out.println("fee amount in $ :" + (fee/str)+"$\n");
}
}
class student1 extends student
{
public void calc()
{System.out.println("Demo for partial implementation of interface\n");
System.out.println("Abstract class Student cannot be instantated , so student1 class is generated by extending student\n");
}
}
class empl implements access
{
int sal,tax;String emp=new String();String name=new String();
public void input()
{


BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter Employee name\n");
name=br.readLine();
System.out.println("Enter your total income \n");
emp=br.readLine();
sal=Integer.parseInt(emp);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}

public void calc()
{
if (sal>500000)
{tax=10000;}
else if (sal>400000)
{tax=9000;}
else if (sal>300000)
{tax=8000;}
else
{tax=5000;}
}
 public void printop()
{System.out.println("Name of the Employee is :  \n"+name);
System.out.println("Total Income is \t " + sal  +"TAX  is \n"+ tax);
}
}
public class mulinh
{
    public static void main(String[] args)
    {
// Printing Student details
    student1 stud1=new student1();
    stud1.input();
    stud1.calc();
    stud1.printop();
// printing Employee details

    empl emp1=new empl();

    emp1.input();
    emp1.calc();
    emp1.printop();

    }
}



program2

import java.io.*;
interface access
{
public int str=54;
public void input();
public void calc();
public void printop();
}
interface access1 extends access
{
public void hobbies();
}
abstract class student implements access
{
int tot,fee;String stu=new String();String name=new String();
String grade =new String();
public void input()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
System.out.println("Enter your Semester fees \n");
stu=br.readLine();
fee=Integer.parseInt(stu);grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}


 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
System.out.println("fee amount in $ :" + (fee/str)+"$\n");
}
}
class student1 extends student
{
public void calc()
{System.out.println("Demo for partial implementation of interface\n");
System.out.println("Abstract class Student cannot be instantated , so student1 class is generated by extending student\n");
}
}
class empbonus
{int bonus=20000;
}
class empl extends empbonus implements access
{
int sal,tax;String emp=new String();String name=new String();
public void input()
{


BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter Employee name\n");
name=br.readLine();
System.out.println("Enter your total income \n");
emp=br.readLine();
sal=Integer.parseInt(emp);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}

public void calc()
{
if (sal>500000)
{tax=10000;}
else if (sal>400000)
{tax=9000;}
else if (sal>300000)
{tax=8000;}
else
{tax=5000;}
}
 public void printop()
{System.out.println("Name of the Employee is :  \n"+name);
System.out.println("Total Income is \t " + sal  +"TAX  is \n"+ tax);
System.out.println("bonus \n" + bonus);
System.out.println("bonus  amount in $:" + (bonus/str)+"$\n");
}
}
public class mulinh1
{
    public static void main(String[] args)
    {
// Printing Student details
    student1 stud1=new student1();
    stud1.input();
    stud1.calc();
    stud1.printop();
// printing Employee details

    empl emp1=new empl();

    emp1.input();
    emp1.calc();
    emp1.printop();

    }
}
program 3
import java.io.*;
interface access
{
public int str=54;
public void input();
public void calc();
public void printop();
}
interface access1 extends access
{
public void hobbies();
}
abstract class student implements access
{
int tot,fee;String stu=new String();String name=new String();
String grade =new String();
public void input()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
System.out.println("Enter your Semester fees \n");
stu=br.readLine();
fee=Integer.parseInt(stu);grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}


 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
System.out.println("fee amount in $ :" + (fee/str)+"$\n");
}
}
class student1 extends student
{
public void calc()
{System.out.println("Demo for partial implementation of interface\n");
System.out.println("Abstract class Student cannot be instantated , so student1 class is generated by extending student\n");
}
}
class empbonus
{int bonus=20000;
}
class empl extends empbonus implements access
{
int sal,tax;String emp=new String();String name=new String();
public void input()
{


BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter Employee name\n");
name=br.readLine();
System.out.println("Enter your total income \n");
emp=br.readLine();
sal=Integer.parseInt(emp);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}

public void calc()
{
if (sal>500000)
{tax=10000;}
else if (sal>400000)
{tax=9000;}
else if (sal>300000)
{tax=8000;}
else
{tax=5000;}
}
 public void printop()
{System.out.println("Name of the Employee is :  \n"+name);
System.out.println("Total Income is \t " + sal  +"TAX  is \n"+ tax);
System.out.println("bonus \n" + bonus);
System.out.println("bonus  amount in $:" + (bonus/str)+"$\n");
}
}
class stuhoppies extends student1 implements access1
{
public void hobbies()
{
System.out.println(" Reading books \n");}
}

class stuhoppies1  implements access1
{
public void hobbies()
{System.out.println(" Reading books \n");}
public void input()
{System.out.println(" input section \n");}
public void calc()
{ System.out.println(" Processing Part\n");}
public void printop()
{System.out.println(" End product section \n");}
}



public class mulinh2
{
    public static void main(String[] args)
    {
// Printing Student details
    student1 stud1=new student1();
    stud1.input();
    stud1.calc();
    stud1.printop();
// printing Employee details

    empl emp1=new empl();

    emp1.input();
    emp1.calc();
    emp1.printop();
// printing student details with extending student1 class and interface access1
stuhoppies stuhop1=new stuhoppies();
    stuhop1.input();
    stuhop1.calc();
    stuhop1.printop();
stuhop1.hobbies();
// extending interface
stuhoppies1 stuhop11=new stuhoppies1();
    stuhop11.input();
    stuhop11.calc();
    stuhop11.printop();
stuhop11.hobbies();


    }
}







program4

import java.io.*;
interface access
{
public int str=54;
public void input();
public void calc();
public void printop();
}
interface access1 extends access
{
public void hobbies();
}
abstract class student implements access
{
int tot,fee;String stu=new String();String name=new String();
String grade =new String();
public void input()
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter your name\n");
name=br.readLine();
System.out.println("Enter your total \n");
stu=br.readLine();
tot=Integer.parseInt(stu);
System.out.println("Enter your Semester fees \n");
stu=br.readLine();
fee=Integer.parseInt(stu);grade="*****";
}
catch(Exception e)
{System.out.println("Student details are not given in correct format\n");}
}


 public void printop()
{
System.out.println("Name of the student is :  \n"+name);
System.out.println("Total Mark is \t " + tot  +"grade is \n"+ grade);
System.out.println("fee amount in $ :" + (fee/str)+"$\n");
}
}
class student1 extends student
{
public void calc()
{System.out.println("Demo for partial implementation of interface\n");
System.out.println("Abstract class Student cannot be instantated , so student1 class is generated by extending student\n");
}
}
class empbonus
{int bonus=20000;
}
class empl extends empbonus implements access
{
int sal,tax;String emp=new String();String name=new String();
public void input()
{


BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.println("Enter Employee name\n");
name=br.readLine();
System.out.println("Enter your total income \n");
emp=br.readLine();
sal=Integer.parseInt(emp);
}
catch(Exception e)
{System.out.println("Enter your correct details\n");}
}

public void calc()
{
if (sal>500000)
{tax=10000;}
else if (sal>400000)
{tax=9000;}
else if (sal>300000)
{tax=8000;}
else
{tax=5000;}
}
 public void printop()
{System.out.println("Name of the Employee is :  \n"+name);
System.out.println("Total Income is \t " + sal  +"TAX  is \n"+ tax);
System.out.println("bonus \n" + bonus);
System.out.println("bonus  amount in $:" + (bonus/str)+"$\n");
}
}
abstract class stuhoppies extends student implements access1
{
public void hobbies()
{
System.out.println(" Reading books \n");}
}
class stuhopabs extends stuhoppies
{
}

class stuhoppies1  implements access1
{
public void hobbies()
{System.out.println(" Reading books \n");}
public void input()
{System.out.println(" input section \n");}
public void calc()
{ System.out.println(" Processing Part\n");}
public void printop()
{System.out.println(" End product section \n");}
}



public class mulinh2
{
    public static void main(String[] args)
    {
// Printing Student details
    student1 stud1=new student1();
    stud1.input();
    stud1.calc();
    stud1.printop();
// printing Employee details

    empl emp1=new empl();

    emp1.input();
    emp1.calc();
    emp1.printop();
// printing student details with extending student1 class and interface access1
stuhopabs stuhop1=new stuhopabs();
    stuhop1.input();
    stuhop1.calc();
    stuhop1.printop();
stuhop1.hobbies();
// extending interface
stuhoppies1 stuhop11=new stuhoppies1();
    stuhop11.input();
    stuhop11.calc();
    stuhop11.printop();
stuhop11.hobbies();


    }
}