0

Method main can't host System.out.printf(..) in this example.

https://code.sololearn.com/cbJG0L19ysj7 Thanks

5th Aug 2018, 9:26 AM
wally22
5 Answers
+ 4
Anime FanGirl 😉👍
5th Aug 2018, 9:57 AM
D_Stark
D_Stark - avatar
+ 3
hi, learn about getters and setters in tutorials the print statement you have in the main method cant access those instances that way. you need object.variable Anime FanGirl this isnt advertising they are wanting help with there code?
5th Aug 2018, 9:39 AM
D_Stark
D_Stark - avatar
+ 3
wally22 yes each time you make an object and pass arguments to the constructor the printf statment prints those parameters to screen each time have a look at this Assignment i made it will help you with your oop coding. i have commented on my code if its any help https://www.sololearn.com/discuss/1305461/?ref=app
5th Aug 2018, 12:03 PM
D_Stark
D_Stark - avatar
+ 1
Thanks https://code.sololearn.com/cz599hbhaJG0 I don't understand why when i put System.out.printf("The construtor for %s %s, members in the club: %d\n", first ,last, members); in main my code don't compile! But if i put System.out.printf("The construtor for %s %s, members in the club: %d\n", first ,last, members); in class Tuna my code work! Thanks for your help.
5th Aug 2018, 11:42 AM
wally22
+ 1
The method main can access to Sytem.ou.println() because this method is static by the way. thanks
6th Aug 2018, 9:36 AM
wally22