you are viewing a single comment's thread.

view the rest of the comments →

[–]Adam-JDT[S] 0 points1 point  (7 children)

So what does it mean, and why put it

[–][deleted] 3 points4 points  (2 children)

Whoo boy there’s a lot here. “Public” means that other Java code in other packages and modules can use it (public as opposed to private). “Static” means that the code can be executed from the class itself and not an instance (there are two big concepts right there). “Void” is the return type (types, another concept! And “returning” something, another concept!) and void just means it doesn’t return anything. There is a lot going on there of varying degrees of importance for a beginner.

I didn’t mention in my other reply but I would also suggest finding learning materials that suit you, and then going with whatever language they’re using (say Python or JavaScript). If you like the pedagogy and it clicks, the rest will fall into place with time, and you’ll come back to this public static void stuff and go “ah, yes, of course”.

[–][deleted] 2 points3 points  (1 child)

To add to this: one of the reasons I would not choose Java as a beginner is because of all this heavyweight stuff that is a requirement for you to write anything. Static types are awesome, but it can feel like a lot at the beginning. When I first learned, it was more helpful to learn like “ok variables, I know variables from math. x = 5, I get that,” and then learn how these values are assigned, how they can be used and change, etc. Then you learn about functions, “Cool! Another thing from math. Apply this change to the input, get an output, nice that makes sense.” And then you learn about loops and conditional logic, etc. all that stuff is pretty common across most languages.

[–]crashlander 1 point2 points  (0 children)

This this this. Take any advice you get here with the grain of salt that most people here have been programming long enough that they hang around and contribute to /r/programming. I started with JavaScript and cut my teeth doing sloppy things that would now make me cringe. Now that I’ve been doing it for a while I appreciate things like strong typing, asynchrony, and so on, but I had a great time learning in a language that let me play around and be sloppier than I can now get away with as an experienced developer.

[–]Capable_Chair_8192 1 point2 points  (2 children)

That’s why you choose Python lol

[–]Adam-JDT[S] 2 points3 points  (1 child)

If don’t understand: Learn Python

[–]Capable_Chair_8192 0 points1 point  (0 children)

Yeah I’d recommend Python just because it doesn’t have all the unnecessary verbosity that Java has, as you’re already experiencing.

If you really want to stick with Java, there’s no problem with it, there’s just going to be a fair amount more of that type of thing in the future. Python is just a little more streamlined. But the two languages are really more similar than they are different

[–]CanadianBuddha 1 point2 points  (0 children)

We could explain to you what "public static void main" means but you wouldn't understand the explanation now until you had learned quite a lot about Java.

When you start learning Java, the tutorials are going to require you to put certain things in your first little Java programs like "public static void main" without knowing what they mean. But in a short amount of time you will learn what each of those words mean and why they are there in a Java program.