Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: whats wrong with my simple code?

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default whats wrong with my simple code?

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package javaapplication4;
    import javax.swing.JOptionPane.*;
    /**
     *
     * @author Joel
     */
    public class JavaApplication4 {
     
         public static void main(String[] args) {
        int antaldagar;
        double dagspris;
        double totpris;
        String indata;
        indata = showInputDialog("antal dagar?");
        antaldagar = Integer.parseInt(indata);
        indata = showInputDialog("Pris per dag?");
        dagspris = Double.parseDouble(indata);
     
        totpris = dagsPris * antaldagar;
        showMessageDialog(null, "Totalt pris: " + totpris);
     
     
     
     
     
        }
    }

    Some of the codes is in Swedish but i dont think that will matter. Here is some messages that followed...

    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: showInputDialog
    at javaapplication4.JavaApplication4.main(JavaApplica tion4.java:18)

    -links removed-


    Thanks for the replies!
    Last edited by jps; June 1st, 2013 at 03:50 PM. Reason: links removed


  2. #2
    Member angstrem's Avatar
    Join Date
    Mar 2013
    Location
    Ukraine
    Posts
    200
    My Mood
    Happy
    Thanks
    9
    Thanked 31 Times in 29 Posts

    Default Re: whats wrong with my simple code?

    Static members must be imported with "import static", not with "import".

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: whats wrong with my simple code?

    Thanks mate Have a lovely day!

  4. The Following User Says Thank You to DaHappy For This Useful Post:

    angstrem (June 1st, 2013)

Similar Threads

  1. Whats wrong with my code?
    By mhphucld in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 26th, 2013, 08:50 PM
  2. Can anyone see whats wrong with this code
    By javapol in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 27th, 2013, 03:59 PM
  3. Please help to understand whats the wrong with my guess. - Simple program
    By rayan2004 in forum Object Oriented Programming
    Replies: 1
    Last Post: December 14th, 2012, 01:03 AM
  4. Simple sorting program, can't figure out whats wrong with my code
    By USC CSCE in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 29th, 2012, 08:38 AM

Tags for this Thread