i have a problem with code below

import javax.swing.*;
class HelloWorld
{

    public static void main(String x[])
    {

        JOptionPane.showMessageDilog(null,"Welcome","Bscs",1);
    }

}

i try my best but i can not understand the following error

HelloWorld.java:5: error: cannot find symbol
        JOptionPane.showMessageDiloge(null,"Welcome","Bscs",1);
                   ^
  symbol:   method showMessageDiloge(<null>,String,String,int)
  location: class JOptionPane
1 error

plz help me

Recommended Answers

The symbol it can't find is "showMessageDiloge" (see line 4 of the error!)
It's because you spelled it wrong.
See the API doc for JOptionPane for the correct spelling

Jump to Post

What james said look Here

Jump to Post

All 7 Replies

The symbol it can't find is "showMessageDiloge" (see line 4 of the error!)
It's because you spelled it wrong.
See the API doc for JOptionPane for the correct spelling

how can i see the API doc

What james said look Here

Slavi: that's the Java 7 version, probably OK, but we should be referring people to the current version of Java (Java 8) unless there's a specific reason not to.

Here is the current API documentation.
It contains details of all the methods and variables for all the classes in the Java SE API. It's an absolutely essential tool for anyone writing Java. I know it's inimidating at first, you absolutely MUST get familiar with it.
I keep it permanantly open in a tab in my browser. and so should you.

agree with Java8 docs for Swing APIs, there weren't significant changes (excluding bridges/APIs between JavaFX8 and Swing)

Yes.
There were all kinds of tiny improvements in Java 8 that weren'y big enough to make the press release, for example (one of my favourites)...
how many times have you done this:

Object value = myMap.get(key);
if (value == null) {
   value = some default or new value
}

Java 8 added

Object value = myMap.getOrDefault(key, defaultValue);

OK, it's not earth-shattering, but these things add up to smaller clearer code, and we need all the help we can get with that!

@JamesCherrill OT - (Xxx)Map isn't good underlaying array for Swing, missing internal index, must be indexed as key, e.g. you can lost indexing in JTable (view v.s. model and vice versa)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.