Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- /**
- * Write a description of class tes here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class tes
- {
- // instance variables - replace the example below with your own
- public static void main(String[] args)
- {
- Scanner keyboard = new Scanner(System.in);
- System.out.println("hello enter first sentence");
- String f = keyboard.nextLine();
- System.out.println("hello enter second sentensce");
- String s = keyboard.nextLine();
- System.out.println("hello enter third sentensce");
- String l = keyboard.nextLine();
- //note that f stands for first, s for second, and l for last
- if(f.compareTo(s) > 0 && f.compareTo(l) < 0)
- System.out.println(f + " First sentence case 1");
- else if(f.compareTo(l) > 0 && f.compareTo(s) < 0)
- System.out.println(f + " First sentence case 2");
- else if (s.compareTo(f) > 0 && s.compareTo(l) < 0)
- System.out.print(s + " Second sentence case 1");
- else if (s.compareTo(l) > 0 && s.compareTo(f) < 0)
- System.out.print(s + " Second sentence case 2");
- else if (l.compareTo(s) > 0 && l.compareTo(f) < 0)
- System.out.println(l + " third sentence case 1");
- else if (l.compareTo(f) > 0 && l.compareTo(s) < 0)
- System.out.println(l + " third sentence case 2");
- //System.out.println(f.compareTo(s));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement