import java.util.Scanner; public class main{ public static void main(String args[]){ Scanner s = new Scanner(System.in); String i = s.nextLine(); System.out.println(i); s.close(); System.close(); } }
>public static void main(String args[]) absolutely disgusting whose idea was this shit
Eli Jackson
in python2:
print raw_input()
Literally english
Luke Bell
It's just boilerplate code, because Java is a verbose language.
Robert Lee
>public static void main(String args[]) The disgusting placement of those square brackets contain the answer to the other question. Yes Java is so smart it will let retards run their shitty code so they don't cry. Except when they cry because it works nevertheless.
Read the documentation next time to produce good code and learn how and why does it work.
Joshua Smith
It literally means an array of strings.
Kevin Cox
String[] args, literally an array of strings, nobody except newcomers that don't understand what they're doing write the brackets after args, seems like it's nothing but tells a lot about how well he understood that.
Aiden Morales
Nobody writes that manually dude. I didn't even notice it.
David Rogers
puts gets
Come at me
Cameron Hughes
The only reason why (String args[]) works is so that newcomer C/C++ coders don't throw a fit kek
Luis Collins
What shitty software autogenerates the main method like that, contrary to the official Java documentation? I know for certain Eclipse certainly doesn't.
Jose Stewart
I mean I've never ever typed it manually after doing my first hello world in Java. It's something that doesn't really stand out to me
Brody Gray
I get that you're memeing, but is System.close() even a real function? Google isn't giving me anything, bros.
Luke Edwards
public (visibility) static (only one instance) void (does not return anything) main (starting point of the program) Strings args[] (array of arguments that passed to the programm when launching)
If it was private there would be no way of knowing where to start Static loads the methods/variables at startup, this way it is always available.
Blame OOP if anything. Hopefully with java 10 there will be a Java REPL integrated in the language and you won't need a main method for each program you do. But this will come until 2020 maybe?
Tyler Allen
It does once you understand arrays. Also who copies and pastes the same code forever unless forever means less than the first 30 programs?
Jacob Campbell
>copy and paste nigga are you high Intellij generates shitload of boiler code for you.
Tyler Smith
Read:
Tyler Wilson
The point is that I literally do not even look at that part of the source code you dense fuck