First answer should be easiest/simple. Either brute force or first thing that comes to mind
- Brute Force
- loops
- hashing
- sorting
- space vs time complexity trade offs
Merge Sort External Merge Sort Quick Sort
int number = Integer.parseInt("1234");
String str = String.valueOf(1234);
str.charAt(a) // n=0 to length()-1
char[] characters = sentence.toCharArray();
byte[] byets = sentence.getBytes();
new StringBuilder().append(a).append(b).toString().toString();
String str = str.trim();
String sentence = "Hello World";
String[] words = sentence.split(" ");
"mesquite in your cellar".replace('e', 'o'); // replace by char
str.matches(regex)
str.replaceFirst(regex, repl)
str.replaceAll(regex, repl)
"unhappy".substring(2) returns "happy"
"hamburger".substring(4, 8) returns "urge"
"to".concat("get").concat("her") returns "together"
- StringBuffer is synchronized, StringBuilder is not.
- If your text is going to change and use by multiple thread better to use StringBuffer. if your text is going to change but use by single thread then use StringBuilder.
Java is always pass-by-value. The difficult thing can be to understand that Java passes objects as references passed by value.
public void foo(Dog d) {
d.name.equals("Max"); // true
d = new Dog("Fifi");
d.name.equals("Fifi"); // true
}
Dog aDog = new Dog("Max");
foo(aDog);
aDog.name.equals("Max"); // true
Sites Careercup geeksforgeeks glassdoor
Questions
Articles
- http://stackoverflow.com/questions/40480/is-java-pass-by-reference http://www.codeproject.com/Articles/11155/Abstract-Class-versus-Interface http://stackoverflow.com/questions/824763/is-polymorphism-another-term-for-overloading/824809#824809 goPee() http://stackoverflow.com/questions/154577/polymorphism-vs-overriding-vs-overloading
Guides
Maps
Blogs