aspose file tools*
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
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: 38363
    
  23
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: 38363
    
  23
Why not use a switch?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A program in Core Java