what is oop, class, polymorphism, interface vs abstract class, left join, full join? doubly link list reversal? reversing words in a string eg "hello world" => "world hello" say you have to arrays a1 and a2. a1 has elements that are in a2. How would you remove those elements from a1 (no restrictions on implementation)
Anonymous
@author ola */ public class ReverseOfStringOfWords { public static void main(String[] args){ /* String x = " hellaz"; int g = x.indexOf(""); System.out.println(g); */ String str2 = "helloworld"; ReverseOfStringOfWords test1 = new ReverseOfStringOfWords(); test1.getReverseString(str2); int x= str2.indexOf(" "); // System.out.println(x); } public void getReverseString(String input){ if(!(input.isEmpty()) && ( (input.indexOf(" ")) != -1)){ String[] str1 = input.split(" "); int y = str1.length - 1; for(int i = y; i>=0; i--){ System.out.println(str1[i] + " "); } } else{ System.out.println(" the input is invalid"); } } }
Check out your Company Bowl for anonymous work chats.