Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ryan Blume
- //Java Practice
- //11/12/19
- public class Strings
- {
- public static void main(String args[])
- {
- String s1 = ("The quick brown fox jumps over the lazy dog");
- String s2 = ("Mississippi");
- String s3 = ("Ryan Blume");
- String s4 = ("mississippi");
- int l1 = (s1.length());
- System.out.println(l1);
- int l2 = (s2.length());
- System.out.println(l2);
- int l3 = (s3.length());
- System.out.println(l3);
- int l4 = (s4.length());
- System.out.println(l4);
- if(s2.equals(s4))
- {
- System.out.println(s2 + " and " + s4 + " are the same");
- }
- else
- {
- System.out.println(s2 + " and " + s4 +" are not the same");
- }
- if(s2.equalsIgnoreCase(s4))
- {
- System.out.println(s2 + " and " + s4 + " are the same when ignoring case");
- }
- else
- {
- System.out.println(s2 + " and " + s4 +" are not the same when ignoring case");
- }
- System.out.println(toUpperCase(String s1));
- System.out.println(toUpperCase(String s2));
- System.out.println(toUpperCase(String s3));
- System.out.println(toUpperCase(String s4));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement