A2oz

What are the Inbuilt Classes Present in Java?

Published in Java Programming 2 mins read

Java offers a rich set of built-in classes that provide essential functionalities for various programming tasks. These classes are part of the Java Platform Standard Edition (Java SE) and are organized into different packages.

Here are some of the most commonly used inbuilt classes in Java:

Core Classes

  • Object: The root of all classes in Java. Every class implicitly inherits from this class.
  • String: Represents immutable sequences of characters.
  • Integer, Double, Float, Long, Short, Byte, Boolean: Wrapper classes for primitive data types.
  • Math: Provides mathematical functions like sqrt, pow, sin, cos, etc.
  • System: Offers system-related functionalities like out for printing to the console and in for reading from the console.
  • Date, Calendar: Classes for manipulating dates and times.
  • Arrays: Provides methods for working with arrays.

Collection Framework

  • List: Ordered collections that allow duplicates.
  • Set: Unordered collections that do not allow duplicates.
  • Map: Key-value pairs for storing data.
  • ArrayList, LinkedList, HashSet, HashMap, TreeSet, TreeMap: Specific implementations of the collection interfaces.

Input/Output (I/O)

  • File: Represents a file or directory.
  • InputStream, OutputStream: Abstract classes for reading and writing data.
  • Reader, Writer: Character-based streams for reading and writing text.
  • Scanner: Used for reading data from various sources like files or the console.

Networking

  • Socket: Provides methods for network communication.
  • URL: Represents a Uniform Resource Locator (URL).
  • URLConnection: Used for connecting to URLs and retrieving data.

Threads and Concurrency

  • Thread: Represents a thread of execution.
  • Runnable: Interface for creating threads.
  • Executors: Provides factory methods for creating thread pools.
  • Semaphore: Used for controlling access to shared resources.

These are just a few examples of the many inbuilt classes available in Java. You can find a comprehensive list in the Java documentation.

Related Articles