java expert?? what the..

i have to do a java program which is calculating the area of a box for me.
but how should i do this?
i really don't understand the meaning of all those commands and stuff because they kinda vary from every time i visit class
so i start with:

import java.io.*;
class Test{
public static void main (string args[]) throws IOException //why that?

and then something like
Scanner sc = newScanner (System.in);
string str = sc.nextLine();

or
BufferedReader input = new BufferedReader
new InputStreamReader (System.in)

and then?? i have no idea coz i cant imagine what the hell those commands actually do :(
Comments
11
why does my journal goes down so fast everytime
stop using our flag retard
Parent
try reading the definition for those java funktions. Java has by far the best definitions pages of all languages...

http://java.sun.com/reference/docs/
java sucks :D , i even fail at making simple exercises and the teacher keeps on saying to me that it isnt rocket science :D
i dont know, sorry
Why do you have an exception after your main method. The code for that is so small its practically noob-proof
No idea about the IOEXCEPION

You should normally import the scanner also (import java.util.Scanner;)

Scanner input = new Scanner (System.in);

and dont forget the "public" -> public class Test{

I have only just learned the basics of java though...
ioexception is to catch any errors, with input/output



you don't need to worry about that, I'm not sure if you don't understand the two other bits of code,

first is creating a new object Scanner and sending the input into a function called nextLine within that class,

the other is just reading the input.

I'd recommend reading your class notes and lecture notes as it'll surely discuss all this :X
well the prob is we didn't write down anything except 1000 lines of fucking code without explanation :<
but thx helped me a bit
Back to top