Online Examination System for all learner!!! coming soon..

JAVA : Program that implements the Concept of Encapsulation.

 Implements the Concept of Encapsulation.

Source Code:

class Emp

{

private int empid;

private String name;

public Emp( int x,String y)

{

empid=x;

name=y;

}

public void show()

{

System.out.println("empid="+empid);

System.out.println("name="+name);

}

}

class Encap

{

public static void main(String arg[])

{

int eid=Integer.parseInt(arg[0]);

String ename=arg[1];

Emp e1=new Emp(eid,ename);

e1.show();

}

}

Output:

empid=2
name=Asish
<<Previous Page                     Download Code                    Next Page>> 

Related JAVA Programs: 

  1. Write a JAVA program to print "Hello World".
  2. Write a JAVA program to find sum of all integer greater than 100 and less than 200, that are divisible by 5.
  3. Write a JAVA program to show how method overriding helps in dynamic method dispatch.
  4. Write a JAVA program to Serach and Delete a specific element from an integer array.
  5. Write a JAVA program to illustrate how super keyword is used to call the parent class constructor within the child class.
  6. Write a JAVA program illustrating parameterized constructor.
  7. Write a Java program to discuss the difference between Break and Continue.
  8. Write a JAVA program to create and access a user defined packages.
  9. Write a JAVA program to calculate the length of a string.
  10. Write a JAVA program to findout the number of Vowels present in the input string.
  11.  JAVA Program that implements the Concept of Encapsulation.
 

C Programming Online Test 1

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answ...