Logo

dev-resources.site

for different kinds of informations.

Day 11 Encupsulation

Published at
12/18/2024
Categories
java
payilagam
encupsulation
Author
v_inoth_f0fad29baec4c
Categories
3 categories in total
java
open
payilagam
open
encupsulation
open
Author
21 person written this
v_inoth_f0fad29baec4c
open
Day 11 Encupsulation

Input 1:

class Friend1
{
String name;
long mobileNo;
int atmPin;

public Friend1(String name, long mobileNo, int atmPin)
{
this.name = name;
this.mobileNo = mobileNo;
this.atmPin = atmPin;
}

public static void main(String[] args)
{
Friend1 f1 = new Friend1("Kavin", 1234, 1111);
f1.withdraw();
}
private void withdraw()
{
System.out.println(atmPin);
}
public void tour()
{
System.out.println("Going for a ride");
}

public void publish_results()
{
System.out.println("Pass with good marks ");
}

}

Input 2:

class Friend2
{

public static void main(String[] args)
{
Friend1 ff = new Friend1("Arul", 3434, 2323);
ff.tour();
ff.withdraw();
}

}

Output:

Image description

Featured ones: