Java INBUILD Methods
Java INBUILD Methods
1. String Methods
● length: str.length()
● substring: str.substring(beginIndex, endIndex)
● charAt: str.charAt(index)
● contains: str.contains(substring)
● indexOf: str.indexOf(substring)
● toLowerCase: str.toLowerCase()
● toUpperCase: str.toUpperCase()
● trim: str.trim()
● replace: str.replace(oldChar, newChar)
● split: str.split(regex)
● startsWith: str.startsWith(prefix)
● endsWith: str.endsWith(suffix)
● equals: str.equals(anotherString)
● equalsIgnoreCase: str.equalsIgnoreCase(anotherString)
● compareTo: str.compareTo(anotherString)
● isEmpty: str.isEmpty()
● concat: str.concat(anotherString)
● valueOf (static): String.valueOf(data)
2. Math Methods
● abs: Math.abs(x)
● max: Math.max(x, y)
● min: Math.min(x, y)
● sqrt: Math.sqrt(x)
● pow: Math.pow(x, y)
● round: Math.round(x)
● random (static): Math.random()
● ceil: Math.ceil(x)
● floor: Math.floor(x)
● sin: Math.sin(angle)
● cos: Math.cos(angle)
3. System Methods
4. Object Methods
● equals: obj.equals(anotherObj)
● hashCode: obj.hashCode()
● getClass: obj.getClass()
● toString: obj.toString()
● clone (protected): obj.clone()
● notify: obj.notify()
● notifyAll: obj.notifyAll()
● wait (overloaded): obj.wait()
● add: collection.add(element)
● remove: collection.remove(element)
● contains: collection.contains(element)
● size: collection.size()
● isEmpty: collection.isEmpty()
● iterator: collection.iterator()
● clear: collection.clear()
● addAll: collection.addAll(anotherCollection)
● removeAll: collection.removeAll(anotherCollection)
● retainAll: collection.retainAll(anotherCollection)
● toArray: collection.toArray()
7. Thread Methods
● start: thread.start()
● run: thread.run()
● join: thread.join()
● sleep (static): Thread.sleep(millis)
● currentThread (static): Thread.currentThread()
● setName: thread.setName(name)
● getName: thread.getName()
● setPriority: thread.setPriority(priority)
● getPriority: thread.getPriority()
● interrupt: thread.interrupt()
● isInterrupted: thread.isInterrupted()
● printStackTrace: exception.printStackTrace()
● getMessage: exception.getMessage()
● getCause: exception.getCause()
15. Serialization
16. Reflection