This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes A program in Core Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A program in Core Java" Watch "A program in Core Java" New topic
Author

A program in Core Java

Sailendra Kumar Barick
Greenhorn

Joined: Nov 18, 2011
Posts: 7
Can anyone write the code in core java-
Input three numbers through Scanner class in variables a,b c.
If a is inputted 1, b inputted null(or blank) and c inputted 3 then output should show a=1 & b=3.
If a is null(or blank), b is 1,c is 4, then output- b=1 & c=4.
If a is 1, b is 2, c is 3, then output- a=1,b=2 & c=3.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Can, yes. Will, no.
Please show us what you have got so far and we shall tell you what we think of it.
Sailendra Kumar Barick
Greenhorn

Joined: Nov 18, 2011
Posts: 7
Campbell Ritchie wrote:Can, yes. Will, no.
Please show us what you have got so far and we shall tell you what we think of it.


I've done it in a inefficient lengthy way, but i need to know any other way of doing it...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Why not use a switch?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A program in Core Java
 
Similar Threads
Code segment question #3(5)
Basic arithmetic problem.
scjp help required
++ confusion
Synchronize an instance variable