How to instantiate a class that is nested inside a class from outside that .java file (Java)? -


i have 2 classes, main , spbhomehelp. here code main:

public class main{        spbhomehelp homehelp;        public main(){              homehelp = new spbhomehelp();              home home = new home();        }   } 

here code spbhomehelp:

public class spbhomehelp{        public spbhomehelp(){        }        public class home{              public home(){                    system.out.println("entered home constructor");              }        }  }    

main , spbhomehelp 2 different .java files. can declare , instantiate instance spbhomehelp. want have instance of home, class nested inside spbhomehelp, in main too. tried:

home home = new home(); 

because home public, doesn't work. how can create instance of home in main?

home instance of inner-class home type (from class spbhomehelp). need instance of class (that ishomehelp), in order construct home instance. think you're looking like

spbhomehelp.home home = homehelp.new home(); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -