Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Imcompatible type error.

$
0
0
    public String getResult(){
        String s2 = JOptionPane.showMessageDialog(null," is higher than Magic Number");
        return s2;
    } 


I am trying to return the String value to getResult() method, but it doesn't work.

The Imcompatible type error keeps occurring. It states that the return value is void, but didn't I return variable s2 which is a String variable ? :helpsmilie:

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>