[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

import java.util.Scanner; public class main{ public static

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 23
Thread images: 2

File: 1486692266707.jpg (82KB, 540x490px) Image search: [Google]
1486692266707.jpg
82KB, 540x490px
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();
}
}


i = input()
print(i)
exit()



Why is this allowed?
>>
>>59134151
What is input()?
>>
Is this a language-vs-language shootdown? Here's a Haskell for ya..
main = getLine >>= putStrLn
>>
Because java is shit made for retards, like you.
>>
>>59134151
ewww
>>
>>59134906
https://docs.python.org/3/library/functions.html#input
>>
>>59134151
>public static void main(String args[])
absolutely disgusting
whose idea was this shit
>>
in python2:

print raw_input()

Literally english
>>
>>59134151
It's just boilerplate code, because Java is a verbose language.
>>
>>59134151
>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.
>>
>>59135996
It literally means an array of strings.
>>
>>59136006
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.
>>
>>59136054
Nobody writes that manually dude. I didn't even notice it.
>>
puts gets


Come at me
>>
>>59135996
>>59136006
>>59136054
The only reason why (String args[]) works is so that newcomer C/C++ coders don't throw a fit kek
>>
>>59136269
What shitty software autogenerates the main method like that, contrary to the official Java documentation? I know for certain Eclipse certainly doesn't.
>>
>>59136523
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
>>
>>59134151
I get that you're memeing, but is System.close() even a real function? Google isn't giving me anything, bros.
>>
>>59135660
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?
>>
>>59136637
It does once you understand arrays. Also who copies and pastes the same code forever unless forever means less than the first 30 programs?
>>
>>59136910
>copy and paste
nigga are you high
Intellij generates shitload of boiler code for you.
>>
>>59137177
Read:
>>59136523
>>
>>59138859
The point is that I literally do not even look at that part of the source code you dense fuck
Thread posts: 23
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.