import javax.swing.*;
class nest
{ int a,b;
public void inn()
{
a=Integer.parseInt(JOptionPane.showInputDialog(" enter a"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter b "));
}
private int chek()
{
if(a>b)
{return a;}
else
{return b;}
}
public void out()
{
System.out.print("larger is : " +chek());
}
}
public class nestingmemberfunction {
public static void main(String[] args) {
nest n=new nest();
n.inn();
n.out();
}
}
class nest
{ int a,b;
public void inn()
{
a=Integer.parseInt(JOptionPane.showInputDialog(" enter a"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter b "));
}
private int chek()
{
if(a>b)
{return a;}
else
{return b;}
}
public void out()
{
System.out.print("larger is : " +chek());
}
}
public class nestingmemberfunction {
public static void main(String[] args) {
nest n=new nest();
n.inn();
n.out();
}
}
output:
enter a 5
enter b 9
larger is 9
No comments:
Post a Comment
SAY HELLO!!