How we use class within a class dats mean a nested class??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How we use class within a class dats mean a nested class???

here d example i do but i dont know how to make dis program fully so plzzzzz answer it https://code.sololearn.com/cIpWz96PcLh6/?ref=app Arun Tomar Helga HAWKEYE Fata1 Err0r Gaurav Agrawal ‎ ‏‏‎ Sreejith Hans Larry Mba Bekale

30th Jun 2018, 4:25 PM
Harsh Agrawal
Harsh Agrawal - avatar
13 Answers
+ 5
Harsh Agrawal your mistake * constructors of outer class is inside inner class i.e bro constructors are inside intro class, which made them functions of intro and a normal function requires return type, so you got the error. To correct this place both constructors of bro outside intro https://code.sololearn.com/ci89Zmz3WG1j/?ref=app
1st Jul 2018, 3:50 AM
‎ ‏‏‎Anonymous Guy
+ 7
Harsh Agrawal simple rule bro nestes class of four type 1.static nested class 2.non static nested class 3.local class 4.anonymous class. ----------------------------+--+---------------- there are some rule to--> most important rule first treated as data member than treated as class..... ----------------------------+--+---------------- where we used neated class. when one properites has futher properities like salary have da,ta,ha ____________________________________________ bro first try to understand the concept then apply I provide you a rule okk. for non static nested class 1.static declaration is not allowed.(non static nested class) 2.you can access anything of outer class. 3.in non static nested class you can only acces the outer class instance data members and members function... ___________________________________________ i provide you basic rule of your problem now creates psvm() and try to solve. ...... happy coding😊
30th Jun 2018, 5:03 PM
Arun Tomar
Arun Tomar - avatar
1st Jul 2018, 4:25 AM
Arun Tomar
Arun Tomar - avatar
+ 6
Harsh Agrawal (see these eq how it work) good bro... and thanks ‎ ‏‏‎ Sreejith I noticed it...
1st Jul 2018, 4:39 AM
Arun Tomar
Arun Tomar - avatar
+ 6
Harsh Agrawal why you used non parameters constructor.. remove it.. okkkkk .....
1st Jul 2018, 4:43 AM
Arun Tomar
Arun Tomar - avatar
+ 4
yeah it's kind of useless
1st Jul 2018, 4:47 AM
‎ ‏‏‎Anonymous Guy
+ 3
Arun Tomar i think those functions are constructors and he misplaced it
1st Jul 2018, 4:30 AM
‎ ‏‏‎Anonymous Guy
+ 3
yaaaa Arun Tomar n ‎ ‏‏‎ Sreejith i just used bcz i just want to make d complete program or d user understand d code nicely thats why i used it BTW u both r awesome but how do u maintain dis????
1st Jul 2018, 4:53 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 2
Harsh Aggarwal if you want to create a class within a class you need to inherit it's properties i.e you need to use the keyword extends or implements eg: class Cat extends Animal
1st Jul 2018, 3:35 AM
Coding Niffler
Coding Niffler - avatar
+ 2
Combine Arun Tomars theory and mine.. and for full understanding..read the lesson again👇 https://www.sololearn.com/learn/Java/2173/
1st Jul 2018, 3:39 AM
Coding Niffler
Coding Niffler - avatar
+ 2
thnxzzzz all of u i get my mistake now u can check my code its working!!!!!!!
1st Jul 2018, 4:31 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
Arun Tomar can u give some e.g. so i understand fully as i hve some confusing in solve dis code???? I rewrite my code but it show error so plzzz find out my error???
1st Jul 2018, 12:43 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
CONGRATULATIONS BRO👍
1st Jul 2018, 4:33 AM
Coding Niffler
Coding Niffler - avatar