Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

public inner class

 
Kush Kush
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Outer
{
public class Inner
{
//inner class code
}
public static void main(String lal[])
{
System.out.println("");
H h=new H();
Inner i=h.new Inner();
}

In above code what is the use of Public (non - static )Inner Class ?
 
Peter Shipway
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the code in the main method somehow relates to it, hence it being public im not sure on this the standard that i folllow is to use the static main class tpo to run another method eg
public static void main (Sting [] args) {
ProgramName tpo = new ProgramName();
tpo.nameofMethod();
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic