DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Results 1 to 5 of 5

Thread: Java help

  1. Droid Sensei
    ilikemoneygreen's Avatar
    Member #
    56291
    Join Date
    Apr 2010
    Location
    AZ, Superstition MTNs!
    Posts
    2,586
    Liked
    206 times
    Phone
    OG D1/G-Nex
    #1

    Java help

    What am I doing wrong? i cant seem to get the second dialog box to popup to enter the value. I could get it to work just in the command prompt using System.out.print but its not working out with the dialog box.
    Code:
    /**Area of rectangle *//* ilikemoneygreen
     * CIS163 29843
     * August 24, 2012
     */
     import java.util.Scanner; // scanner package
     import javax.swing.JOptionPane;
     public class RectangleArea {
         public static void main(String[] args) {
             //input the length and width
             Scanner input = new Scanner(System.in);
    
    
             //prompt user for length
             JOptionPane.showInputDialog(null, "Enter the length : " , "Length" , JOptionPane.INFORMATION_MESSAGE);
             double length = input.nextDouble();
             //Prompt user for Width
             JOptionPane.showInputDialog(null, "Enter the width : " , "Width" , JOptionPane.INFORMATION_MESSAGE);
             double width = input.nextDouble();
    
    
             //calculate area
             double area = length * width;
             //Display the results
             System.out.println("The area of a Rectangle with a width of " + width + " and a length of " + length + " is " + area); 
         }
     }
    If you help me, ill give you a cyber hug.
    Turtle bit me.I thought they were slow....they snap so fast. ................. <3
  2. Senior Droid
    smokeyrd's Avatar
    Member #
    279875
    Join Date
    Aug 2012
    Location
    Atlanta, Ga
    Posts
    134
    Liked
    5 times
    Phone
    Motorola Droid Razr MAXX
    #2
    Im having flashbacks to middle school and programming my TI81...not the 83, not the 83+, not the silver edition...the 81. Unfortunately Im not quite sure where you are going wrong...The code looks good to me but Im by no means a java guy. Is it giving you any output at all?
    In God we trust. Everyone else keep your hands where I can see them.
  3. Droid Sensei
    ilikemoneygreen's Avatar
    Member #
    56291
    Join Date
    Apr 2010
    Location
    AZ, Superstition MTNs!
    Posts
    2,586
    Liked
    206 times
    Phone
    OG D1/G-Nex
    #3
    lol, i cant say ive ever seen an 81. sounds like you had fun with it though. My friend was obsessed with his calc, he played doom in class i think then the teacher wiped it all away.
    and the out i get is it does the first dialog box. I then input a number and hit enter then nothing happens, it hangs. Im thinking its a logic error, which are usually a pain.....
    Turtle bit me.I thought they were slow....they snap so fast. ................. <3
  4. Senior Droid
    smokeyrd's Avatar
    Member #
    279875
    Join Date
    Aug 2012
    Location
    Atlanta, Ga
    Posts
    134
    Liked
    5 times
    Phone
    Motorola Droid Razr MAXX
    #4
    I learned early on to archive my apps...that way when they wipe, the app stays. Great for having cheat sheets In any case, sorry...Im drawing a blank. This is the reason I hate coding. I hope someone else can be of assistance here.
    In God we trust. Everyone else keep your hands where I can see them.
  5. Droid Sensei
    ilikemoneygreen's Avatar
    Member #
    56291
    Join Date
    Apr 2010
    Location
    AZ, Superstition MTNs!
    Posts
    2,586
    Liked
    206 times
    Phone
    OG D1/G-Nex
    #5
    im confident someone on here will know. this forum is quite a few nerdy people.
    Turtle bit me.I thought they were slow....they snap so fast. ................. <3

Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Java
    By maxwellag in forum Android Forum
    Replies: 4
    Last Post: 03-04-2012, 09:37 AM
  2. Java
    By brad92 in forum Droid X General Discussions
    Replies: 1
    Last Post: 06-11-2011, 10:58 AM
  3. Java
    By micp1480 in forum Android General Discussions
    Replies: 5
    Last Post: 10-26-2010, 09:22 PM
  4. Java Help
    By J-Buck in forum Off Topic Forum
    Replies: 2
    Last Post: 08-03-2010, 08:53 AM
  5. java?
    By goodnyt in forum Android Tech Support
    Replies: 3
    Last Post: 12-13-2009, 08:02 PM

Search tags for this page

can i trust java

,

java popup dialog box not working in cmd

Click on a term to search our site for related topics.
Find us on Google+