aspose file tools*
The moose likes Beginning Java and the fly likes [Confusion] A Java Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "[Confusion] A Java Question" Watch "[Confusion] A Java Question" New topic
Author

[Confusion] A Java Question

Lavneet Sharma
Greenhorn

Joined: Dec 29, 2011
Posts: 10
Get three exam grades from the user and compute the average of the grades. Output the average of the three exams.

1. Use BufferedReader to get input from the user, and System.out to output the result.
2. Use JOptionPane to get input from the user and to output the result.

I'm confused. Because when I try Buffered Reader to accept Interget or float, it says, "Incompatible Types"

And the same for JOptionPane. Can somebody please help me out of this.?
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Can you post the code you tried, the exception stack trace if any.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3056
    
  33

I think we would require some effort from your part in providing us the details about the issue and also show us the code you are trying.


Mohamed Sanaulla | My Blog
Lavneet Sharma
Greenhorn

Joined: Dec 29, 2011
Posts: 10
I tried this Code, but the error is again: Incompatible Types
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3056
    
  33

You should get some idea about Using JOptionPane, and also check out the JOptionPane API to see what the method showInputDialog returns
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Raphael Onofre, please note what it says on the title page for this forum:
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
If Lavneet Sharma looks in the API documentation and finds the return type of the input dialogue is a Rhubarb object, he will remember for ever. If you simply give a complete answer, he might never learn anything.
Don’t be annoyed with me, but I am pulling rank and deleting your post for a day or two.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Apart from the vague thread title: I am 99% certain that try-finally does not do what you think it does, and does not do what you want it to.
Raphael Onofre
Greenhorn

Joined: Dec 29, 2011
Posts: 8
Campbell Ritchie wrote:Raphael Onofre, please note what it says on the title page for this forum:
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
If Lavneet Sharma looks in the API documentation and finds the return type of the input dialogue is a Rhubarb object, he will remember for ever. If you simply give a complete answer, he might never learn anything.
Don’t be annoyed with me, but I am pulling rank and deleting your post for a day or two.


Sorry for the mistake ;[

Lavneet Sharma
Greenhorn

Joined: Dec 29, 2011
Posts: 10
Thanks a lot Mohamed and Sherrif for your concern...
Actually, i made a little ammendment that i learnt from somewhere over the net. I did this:

int x;
x = Integer.parseInt( JOptionPane.ShowInputDialog("TEST");
Jason Bullers
Greenhorn

Joined: Dec 27, 2011
Posts: 28

Campbell Ritchie wrote:I am 99% certain that try-finally does not do what you think it does, and does not do what you want it to.


That's the first thing I noticed when I saw the code snippet. It would be a good idea to explore that topic further, as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Confusion] A Java Question
 
Similar Threads
JOptionPane or JFrame?
Keep getting this error and not sure why
intercepting return from JOptionPane
Netbeans and Ctrl + z (end of file)
hello...I need only help....in this question