Guys help how do I do this in java

guys help how do I do this in java
its pretty hard
pic related

Other urls found in this thread:

tutorialspoint.com/c_standard_library/c_function_atoi.htm
youtube.com/watch?v=VTDXsehyXls
twitter.com/SFWRedditImages

You should stick to C/C++!
Java sucks, hate it

> Using "print"

I have to for a stupid class

how would you format then?
>implying puts()

What an asnwer!

public class Atoi {
public static void main (String[] args) {
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);

int mul = a*b;
int sum = a+b;

System.out.println("* = " + mul + "\n" + "+ = " + sum);
}
}

>posting in b

what kind of theme or wtf is that

>cout

With this in my mind, I'll still help out:
Java gets parameters too, as 'args' [Main(string[] args)], and to parse the to int you'll do:
int ni = Integer.parseInt(args [i]);

what's with this public class stuff
can it be private?

...and here the "clean" version.

java doesn't have something like printf?

I'm implying that it's in its own file...
Atoi.java

There's a chance that the first argument will be the name of the program, so make sure it's not args[1] and args[2]

so let me get this straight
the things in blue are classes
classes are methods and data into one
classes can inherit from other classes, be children etc,

so if I want the jvm to run some method within a class, I have to name the file as the class too?

public means that it is accessible from members that are not a part of the class ya dingus.

lol now it has
No, just kidding. Java doesn't have a simple "print", like for example python has.

Yes! If the only and public class has a name that is NOT the name of the file, it will not compile.

That's a verbose language.

nigga you dumb?
args are additional arguments.

so what's the big deal about oop
can java into pointers

Nice dubs! I never heard of that in Java though. When I compile my shit in Eclipse, the arguments are always only the ones I give it to.

what do you mean?

True. Before starting actual things, you have to define lots and lots of things. There's a reason why people prefer scripting languages for smaller tasks.

No. Just No. Sorry!

Lmao I bet haskell has a shorter version of this

java has no pointers but objects are pretty much always referenced (same functionality) unless your object is either a primitive datatype or a immutable custom object.

wait, + is for integers and strings??

Exactly. For other cases, just clone the overload parameters before doing stuff.

Is there only one main like in C and Haskell?

Yes! It's called polymorphism. The println function combines, like some other functions, strings when they are separated with a '+'.

System.out.println('Shitty string');

If ' is used for strings, then how do you do chars in Java?

Polymorphism for me means working on other types of number like floats or complex numbers, but adding in strings seem strange.

Kinda. If you export a bunch of classes of a so called runnable jar-file, you must declare which class to take. Therefore it guarantees that it exports the right class in case many classes within a package or source folder have their own mains.

'char' "String"

It is the other way round.
' for chars
" for strings

So everything is a class huh.

Yes. Therefore, technically speaking, Java has no functions, only methods.

by that definition, c's printf is polymorphic

I'm sure I heard it in the operator context as well.

where'd you learn java

kek

Taught myself coding since I hung out with the nerd kids at school, and we all loved coding. I started with Visual Basic though, learned some other languages, now I stick with Java because I use scientific packages that only exist in Java (the Chemistry Development Kit, to be exact).

What's so kek about it?

so you're a programmer or a chemist?

Neither. I'm a pharmacist, but I also have a master's degree in pharmaceutical sciences and technologies. I focus on computer-aided drug design.

You can create drugs?

I can suppose chemical structures that prove as "drug-like" and provide certain features that could give a hint whether it can do something to your body or not. Shit's all heavily theoretical. I also have some lab experience though, since I had an internship during my master study in a drug synthesis lab.

You have interesting background, don't know what you're doing in Sup Forums lol.
GOod luck

Thanks. But doing science doesn't mean that I'm not a Sup Forumstard.

tutorialspoint.com/c_standard_library/c_function_atoi.htm

Java has "System.out.format" a la printf

how can a more modern language not have a more sophisticated formatting function?

System.out.format is there from the start of Java to try and bait C-programmers to switch over. It's recognisable.

Println is the most modern Java has I think, remember that Java is from the 90s

why is java popular
what does it bring to the table?

Object orientation. Was new back then (In a non-academic language)

Can your language even do this?

Just use awk:

$ echo 1 -1 | awk '{printf "* = %s\n+ = %s\n",$1*$2,$1+$2}'
* = -1
+ = 0

can YOUR language even do THIS?
for i in range(1,101): print "FizzBuzz"[i*i%3*4:8--i**4%5] or i

That's pretty hot actually.

>le unreadable code
pic related is the most readable and most pretty looking code ever

>putStrLn . fizzbuzz
U N R E A D A B L E

also
>putStrLn
wtf, can't they just do print
>fizzbuzz n \n \t \t \t \t = case
lmao what the fuck is this

multiple entities to perform a switch operation on
i must admit this is pretty damn cool

That's the same as You twat.

Can your language even do this?

let i=0;
while(i

>imperative programming

>2017
>using any programming language other than javascript

>javascript
>a language who's foundations were made in 5 min

lmaoing @ ur life

youtube.com/watch?v=VTDXsehyXls

youtube.com/watch?v=VTDXsehyXls

youtube.com/watch?v=VTDXsehyXls

youtube.com/watch?v=VTDXsehyXls

youtube.com/watch?v=VTDXsehyXls

youtube.com/watch?v=VTDXsehyXls

int
main()

>he doesn't write his functions like that

...

Pointer to a pointer to an array of chars for arguments.
This is why Java is superior.

>he doesn't know that it signifies an array of strings

also, stop being a brainlet

>Primitive programming jargon
>brainlet
kys

Can your language even do this?

︵‿︵(´ ͡༎ຶ ͜ʖ ͡༎ຶ `)︵‿︵