Java Strings Part One- 33 Problems with Solutions
Problem-1 Given a string name, e.g. “Bob”, return a greeting of the form “Hello Bob!”. Example: helloName(“Bob”) → “Hello Bob!” helloName(“Alice”) → “Hello Alice!” helloName(“X”) → “Hello X!” Solution public String helloName(String name) { return “Hello”+” “+ name+”!”; } Problem-2 Given two strings, a and b, return the result of putting them together in the … [Read more…]