#what does new mean?

1 messages ยท Page 1 of 1 (latest)

polar wind
#

Why do we do this in Java?

"Scanner scanner = new Scanner"

What does the new do?

brisk elkBOT
#

<@&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>.

empty vortex
#

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

brisk elkBOT
#

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 cat_thumbs_up

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?.

polar wind
#

thks

polar wind
#

What is the purpose of this:

public static void main(String[] args)

And why is it called at startup?

empty vortex
#

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

polar wind
#

thks