#what does new mean?
1 messages ยท Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
In Java, the new keyword is used to create a new instance of a class, allocating memory for the object. In this case, new Scanner creates a new Scanner object that can be used to read input from various sources such as the console or files.
Useful links:
its a way to make an instance of a class
by calling its constructor
this is something u well get taught when you are about to learn OOP
if ur not at that point yet, ignore it for now
thats also why java 25 introduced alternatives for all of that stuff for beginners so u don't get exposed too early to this stuff
if ur interested in that, we recommend using the book Modern Java
which teaches java in a better way, using these newer features
For learning Java, we recommend the ebook Modern Java:
https://javabook.mccue.dev/
It is completely free, meant for beginners and covers all content relevant for the first year. It is a great way to learn Java from the ground up.
If you run into any questions during your journey, you may ask us in #1051826284008853505 and we will help 
If you prefer a more traditional learning experience, we also recommend MOOC:
https://java-programming.mooc.fi/
This is the course used by the University of Helsinki to teach their students programming in their first year, also completely free.
what does new mean?
Changed the title to what does new mean?.
thks
What is the purpose of this:
public static void main(String[] args)
And why is it called at startup?
another one of those "ull learn it down the road and java 25 got rid of it for beginners" lol
java needs to know where to start ur program. imagine u have thousand files and lots of code. where should java start, what to execute first? for now all u need to know is that this is how java knows where to start
it's called the main-method
ull learn what a method is and how to make ur own later ๐
in java 25 a valid and complete program looks like this:
void main() {
String name = IO.readln("Whats your name?");
IO.println("Hello " + name);
}
no class, no public static, no String[] args, no Scanner, no new,...
all that confusing stuff is gone
๐
and it's then introduced at the right timing instead of right in ur first week
thks