Nested Member Function in Java


Here is the simple program for printing basic example using Nested Member Function in Java.

Source Code

import java.io.*;
import java.util.Scanner;
//www.tutorjoes.com
class nested
{
  public static void main(String args[])
  {
   member o =new member();
   o.display();
  }
}
class member
{
  private int a,b,c;
  member()
  {
   a=10;
   b=34;
  }
  public int large()
  {
   if(a>b)
   c=a;
   else
   c=b;
   return(c);
  }
  public void display()
  {
   System.out.print("Largest No : "+large());
  }
}
To download raw file Click Here

Output

Largest No : 34


Learn All in Tamil © Designed & Developed By Tutor Joes