+ 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
13 Antworten
+ 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
+ 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😊
+ 6
Harsh Agrawal
this is your eq......
learn and change your code
okk bro..
https://code.sololearn.com/cSQRtjGToegs/?ref=app
https://code.sololearn.com/cIk4BfQ66z93/?ref=app
+ 6
Harsh Agrawal (see these eq how it work)
good bro...
and thanks
Sreejith
I noticed it...
+ 6
Harsh Agrawal
why you used non parameters constructor..
remove it..
okkkkk
.....
+ 4
yeah it's kind of useless
+ 3
Arun Tomar i think those functions are constructors and he misplaced it
+ 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????
+ 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
+ 2
Combine Arun Tomars theory and mine..
and for full understanding..read the lesson again👇
https://www.sololearn.com/learn/Java/2173/
+ 2
thnxzzzz all of u i get my mistake
now u can check my code its working!!!!!!!
+ 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???
+ 1
CONGRATULATIONS BRO👍