Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

incompatible types - found java.lang.String but expected int

843810Jan 25 2008 — edited Jan 25 2008
This is an extremely small simple program but i keep getting an "incompatible types - found java.lang.String but expected int" error and dont understand why. Im still pretty new to Java so it might just be something stupid im over looking...

import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Lab
{
public static void main(String []args)
{

int input = JOptionPane.showInputDialog("Input Decimal ");
String bin = Integer.toBinaryString(input);
String hex = Integer.toHexString(input);
System.out.println("Decimal= " + input + '\n' + "Binary= " + bin + '\n' + "Hexadecimal " + hex);

}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2008
Added on Jan 25 2008
1 comment
1,299 views