-
-
Save marisnb/93771c6e6829495d5862aabc6a1c5ad0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SortingArray { | |
public static void main (String args[]) { | |
String date = "01/01/2019"; | |
int days = 10; | |
System.out.println("EX :- 1"); | |
System.out.println("----------"); | |
System.out.println(String.valueOf(Integer.parseInt(date.substring(0,2)) + days) + date.substring(2)); | |
System.out.println(""); | |
System.out.println("EX :- 2"); | |
System.out.println("----------"); | |
String [] list = {"d","c","e","a","b"}; | |
for(int i = 1; i < list.length; i++) { | |
if(list[i].compareTo(list[i - 1]) < 0) { | |
String temp = list[i]; | |
list[i] = list[i - 1]; | |
list[i - 1] = temp; | |
i = 0; | |
} | |
} | |
System.out.println(Arrays.toString(list)); | |
System.out.println(""); | |
System.out.println("EX :- 3"); | |
System.out.println("----------"); | |
System.out.println((days & 1) == 0 ? "Even":"ODD"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment