S
S
schoolboy2015-09-28 15:52:28
Java
schoolboy, 2015-09-28 15:52:28

I'm starting to program in Java, what's wrong with this program?

I started programming in Java, I solve problems in informatics and study there, but the program does not compile on ideone.com and on other compilers.
What's wrong?

package myprogram;
import java.io.PrintStream;
import java.util.Scanner;

public class myprogram; {

  public static Scanner in = new Scanner(System. in );
  public static PrintStream out = System.out;

  {
    int a;
    a = in .nextInt();
    out.print(a / 10);
  }
}

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vit, 2015-09-28
@schoolboy

the program does not compile on ideone.com and on other compilers, what is wrong?

The compiler outputs an error message. It says "what's wrong"

X
X-, 2015-09-29
NoNAME @XNoNAME

Doesn't compile due to ; after the class name
public class myprogram ; {
After compilation will not work due to the absence of the main method

S
Sanan Yuzb, 2015-09-28
@Sanan07

Remove line
package myprogram

A
Alexey, 2015-09-28
@vaseel1ch

and to public static void main(String[] args) , you need to add trhrow IOExceptions

A
abs0lut, 2015-09-28
@abs0lut

Start with some introductory tutorial on setting up the environment and running the first "Hello world". For example here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question