I'm new to java and i'm taking this java class in I have to create a program that prompts the user to enter his/her high school's name, and two decimal number (ie. 5.8, 3.45). what i have is

public class FirstProgram2
{
        public static void main (String[] args)
       {
                System.out.println("Martin Luther King High School.") ;
                System.out.println("Karen Walker.") ;
                System.out.println("5.8.") ;
                System.out.println("3.45.") ;

               System.out.println("Let's demonstrate a simple calculation.") ;
               int answer;
               answer = 2 + 2;
               System.out.println (3 + 5);
      }
}


every time i try to run it, it says i have a error, i have no idea where i went wrong any help will do

Edited 3 Years Ago by happygeek: fixed formatting

import javax.swing.JOptionPane;
public class FirstProgram2
{
        public static void main (String[] args)
       {
            String school = JOptionPane.showInputDialog("Enter your school name"); 
            String first = JOptionPane.showInputDialog("Enter first decimal number") ;
            String second = JOptionPane.showInputDialog("Enter second decimal number") ;
                

               System.out.println("Your school's name is " + school) ;
               System.out.println("first number you entered is " + first);
               System.out.println("second number you entered is " + second);  

      }
}

If you want to do anything else .. what are you planning to do ... and what exactly are the errors you are getting.??

This article has been dead for over six months. Start a new discussion instead.