• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

initialising result  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to java and having problems using the JOptionPane?
I was wondering why I am being asked to initialise a String? infact even when I initialise the String it quite rightly states this is an int. I cannot see what I have done wrong and can't find any help as to why this is. any help would be much appreciated. Thank you very much

public static void main(String[] args)
int side1, side2, side3 ;
String side1Str, side2Str, side3Str, result;

side1Str = JOptionPane.showInputDialog("Enter side1");
side1 = Integer.parseInt(side1Str);

side2Str = JOptionPane.showInputDialog("Enter side2");
side2 = Integer.parseInt(side1Str);

side3Str = JOptionPane.showInputDialog("Enter side3");
side3 = Integer.parseInt(side1Str);

if ((side1 > side2) == true)
if((side1 < side3) == true)

result = "That is an isosceles Traingle";
// JOptionPane.showMessageDialog (null, result); // This is the line I am having trouble with//

author & internet detective
Posts: 39283
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. We have a forum just for Swing/AWT/etc. Since this isn't about JSP, I'll move it for you.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!