Java public block | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Java public block

Hello PROgrammers👀 Is there any way change all my global-variable to public just by using {}... Or something like that? For example... public { int age; String name; double height; } Where it's makes all the inside variables to public... instead of adding the keyword "public" for every single variables? Inserd of like this... public int age; public String name; public double height; Thanks! Happy coding

2nd May 2020, 4:37 PM
KingDaniel2004
KingDaniel2004 - avatar
4 Answers
+ 4
This kind of thing is only present in the Cs as far as I remember. Plus it's just one word. What's the hassle?
2nd May 2020, 4:40 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
This is kinda a bit too lazy. It's just a public keyword!!
2nd May 2020, 4:43 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Too Lazy😂
2nd May 2020, 4:42 PM
KingDaniel2004
KingDaniel2004 - avatar
+ 2
Martin Taylor yeah I Know, I'm just giving an example
2nd May 2020, 5:49 PM
KingDaniel2004
KingDaniel2004 - avatar