Java Standard Library (also known as Java API) is a collection of classes, interfaces, and packages that come bundled with the Java Development Kit (JDK). The library provides many built-in methods that you can use in your Java programs without having to write the code from scratch. Here are some of the commonly used methods in the Java Standard Library:
-
String methods: The String class in Java provides many useful methods for manipulating strings. Some of the commonly used methods include
length()
,charAt()
,substring()
,indexOf()
,equals()
,equalsIgnoreCase()
,toLowerCase()
,toUpperCase()
,trim()
,replace()
, etc. -
Math methods: The Math class in Java provides many mathematical functions such as
sqrt()
,abs()
,ceil()
,floor()
,pow()
,max()
,min()
,random()
, etc. -
Date and Time methods: The java.time package in Java provides classes for working with dates and times. Some of the commonly used classes include
LocalDate
,LocalTime
,LocalDateTime
,ZonedDateTime
,Duration
,Period
, etc. -
Collection methods: The Java Standard Library provides many classes for working with collections such as
List
,Set
,Map
,Queue
, etc. Some of the commonly used methods includeadd()
,remove()
,size()
,contains()
,get()
,put()
,isEmpty()
, etc. -
File and IO methods: The Java Standard Library provides classes for working with files and input/output operations. Some of the commonly used classes include
File
,InputStream
,OutputStream
,Reader
,Writer
,BufferedReader
,BufferedWriter
, etc. -
Networking methods: The Java Standard Library provides classes for working with networking such as
Socket
,ServerSocket
,InetAddress
,URL
,URLConnection
, etc.