Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can you call a private data from an inner class?

Answer Posted / jettimadhuchowdary

public class MainTest {
private int localPr =1;
public int localPb = 20;
protected int localPro = 3;
int localDf = 5;
/**
* @param args
*/
public static void main(String[] s) {
// TODO Auto-generated method stub
MainTest mainTest = new MainTest();
InnerClass class1 = mainTest.new InnerClass();
class1.call();
}
class InnerClass
{
void call() {
System.out.println(" display data localDf ="+ localDf);
System.out.println(" display data localPro ="+ localPro);
System.out.println(" display data localPb ="+ localPb);
System.out.println(" display data localPr ="+ localPr);
}
}

}

and the output is

display data localDf =5
display data localPro =3
display data localPb =20
display data localPr =1

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which class is the wait() method defined in? : Java thread

1001


What is data type in java?

958


What is a website container?

1024


Are functions objects in java?

1135


Can we use this () and super () in a method?

1036


What is the purpose of finalization in java programming?

1078


What is the access scope of protected access specifier?

1049


Can we make a constructor final?

1091


What is the difference between a local variable and an instance variable?

1191


What is the difference between the final method and abstract method?

1124


Can a function return a function?

1106


Why string is not a wrapper class?

1232


What is the common usage of serialization? What exceptions occur during serialization?

1207


What is a war file?

1170


What is the difference between reader/writer and inputstream/output stream?

1148