“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, etc. This is mostly to differentiate from others like Java ME or Java EE. “Core Java” is Oracle’s definition and refers to subset of Java SE technologies.
The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications.
Related Tags
Tutorials
Learn about String class in Java, the motivation behind making it immutable, and the idea of a String constant pool. We will see how memory is manipulated when we create String instances via String literals or String constructors. Finally, we will go through the main advantages and disadvantages caused by …
Learn to create Java enum where each enum constant may contain multiple values. We may use any of the values of the enum constant in our application code, and we should be able to get the enum constant from any of the values assigned to it. 1. How to Create …
Learn to check if a given Date is a weekend in Java. We will learn to check using java.util.Date as well as Java 8 java.time.LocalDate classes. In the given examples, we are assuming that a weekend is either Saturday or Sunday. The rest five days of the week are weekdays. …
The Java FileWriter class is for writing the text to the character-based files using a default buffer size. It uses character encoding default to the platform, if not provided otherwise. FileWriter is usually wrapped by higher-level Writer types, such as BufferedWriter or PrintWriter. FileWriter provides better performance and higher-level, more …
The Java InputStreamReader class is often used to read characters from files (or network connections) where the bytes represents text. In this Java tutorial, we will learn about InputStreamReader class, its creation and initialization, and its methods which help in reading the data from the source. 1. InputStreamReader class It …
Java StringReader represents a character stream whose source is a string. Use it to pass a string to a method that accepts a Reader Type.
Java FileReader class can be used to read data (stream of characters) from files. In this tutorial, we will learn about FileReader class, its constructors, methods and usages with the help of examples. 1. Introduction The FileReader class is: 2. Creating FileReader To use the FileReader in the application, we …
Learn to install Java on 64-bit Windows machines in this step-by-step guide. 1. Navigate to the Oracle Java Download Page Navigate to the Java download page for the latest Java release. Click on the link “JDK Download”. 2. Download the zip or Exe Package Here you have two choices: 2.1. …
Learn to write your first “Hello World” program in Java. It is often used to verify that the Java runtime is setup correctly.
Learn to read a file from classpath in Java. The file can be present at root of class path location or in any relative sub-directory.
Learn about traditional instanceof operator, enhancements introduced with pattern matching and the scope of pattern variables with examples.
Java records were introduced as a preview feature in Java 14 [JEP-359] and finalized in Java 16 [JEP-395]. A record, in Java, acts as a transparent carrier for immutable data. Conceptually, records can be thought of as tuples that are already available via 3rd party libraries. Though, records are built-in type …
Introduced in Java 13 as part of the enhancements in Project Amber, the ‘yield‘ keyword aims to simplify code, making switch expressions more concise and expressive. Let us learn about ‘yield‘ keyword, its purpose, syntax, and see some practical examples. 1. The ‘yield‘ Keyword The ‘yield’ keyword enhances the switch …
The SoftMaxHeapSize option sets a soft limit on how large the Java heap should grow. When set, the GC will try not to grow the heap size beyond this limit.
Learn to create and use the Period class that was introduced as part of the new Date Time API in Java 8. The Period class represents the period of time in date-based values such as days, months, years, weeks, or years in the ISO-8601 calendar system such as “1 year …
Learn to use Java TemporalAdjusters that help with complex date-time calculations such as calculating recurring meeting dates, processing weekly reports, sending automated monthly report outs, etc. 1. Overview In the new Java Date API, the Temporal interface represents a date, time, or a combination of both. For example, LocalDate, LocalDateTime …
Learn to format a given date to a specified formatted string in Java. We will learn to use inbuilt patterns and custom patterns with DateTimeFormatter and SimpleDateFormat. 1. Formatting with DateTimeFormatter [Java 8] Since Java 8, We can use DateTimeFormatter for all types of date and time related formatting tasks. …
Learn to validate whether a given string contains a date value in Java using various date validation techniques available in Java 8.
Learn to get all the dates between the two given dates. We will see the solutions in Java 7, Java 8, and Java 9. 1. LocalDate.datesUntil() (since Java 9) LocalDate‘s datesUntil() method returns a sequential ordered stream of all dates between two given dates. The returned stream starts from startDate …
In Java, we can use the ChronoUnit and LocalDate.until() methods to calculate the number of days between two given dates. Other solutions exist, but these are the simplest and do not require importing an additional library. 1. Using ChronoUnit to Find the Number of Days between Two Dates Using ChronoUnit.DAYS.between() …
Learn to find all business days between two given dates in Java. The business days are considered all weekdays, excluding all holidays falling on weekdays. Once we have a List of business dates, we can use the list.size() API to get the total count of business days. The given examples …
Learn to add or subtract a given number of business days to new date times classes in Java such as LocalDate, LocalDateTime and ZonedDateTime. The given example takes the holidays list as well into consideration. Read More: Add or Subtract Days to/from Date 1. Adding Business Days It uses two …
Learn to determine which day of the week is a given date in Java. The weekdays are considered all 7 days from Sunday, Monday till Saturday. 1. DayOfWeek Enum DayOfWeek is an enum representing the seven days of the week – Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. 2. …
TemporalQuery is a standard way of querying the temporal objects (LocalDate, LocalDateTime etc) for making better business decisions. In Java 8, all major date-time classes implement Temporal and TemporalAccessor interfaces so TemporalQuery can be run against all those Java classes. 1. TemporalQuery interface In the new Java Date API, Temporal …
Java examples to get the next day or the previous day for any given day. The example uses legacy java.util.Date class as well as java.time.LocalDate class from Java 8. We can use this example code to calculate tomorrow’s and yesterday’s dates based on the date of today. 1. Using LocalDate …
Learn what is UUID and it’s versions and variants. Learn to generate UUID in Java using UUID.randomUUID() API. Also learn to generate version 5 UUID in Java. 1. What is UUID? UUID (Universally Unique IDentifier), also known as GUID (Globally Unique IDentifier) is 128 bits long identifier that is unique …
Learn to work with key value pairs in Java using Pair classes e.g. javafx.util.Pair, ImmutablePair, MmutablePair (common langs) and io.vavr.Tuple2 class. Read More : Tuples in Java 1. Why we need pairs? A pair provide a convenient way of associating a simple key to value. In Java, maps are used …
Learn to convert a string to date time instance classes e.g. ZonedDateTime or OffsetDateTime classes, using DateTimeFormatter class in Java. 1. Instant, OffsetDateTime and ZonedDateTime Classes In Java 8, OffsetDateTime and ZonedDateTime – both store an instant on the universal timeline to nanosecond precision. OffsetDateTime adds to the instant the …
Learn to parse date and time strings into instances of LocalDate and LocalDateTime using strict style using ResolverStyle.STRICT parameter with DateTimeFormatter instance.
In regex, we can match any character using period “.” character. To match only a given set of characters, we should use character classes.
Regular expressions, commonly referred to as regex, are powerful tools for pattern matching and manipulation of text. The regex patterns enable developers to perform intricate string searches, substitutions, and validations. Among the plethora of regex features, line anchors are the key components for precisely identifying the beginning or end of …
DelayQueue class is an unbounded blocking queue of delayed elements, in which an element can only be taken when its delay has expired.
Learn ExecutorService shutdown(), shutdownNow() and awaitTermination() APIs and how to use them correctly to shutdown executor under different conditions,
Learn to cancel a task submitted to an executor service that still has to be executed not completed yet using Future.cancel() API.
Learn to execute a task after a period of time or execute it periodically using ScheduledExecutorService class in Java using ScheduledThreadPoolExecutor.
Learn to run multiple Callable tasks with ExecutorService.invokeAll(tasks) API and processing all the results returned from tasks in form of Future class instances in this ExecutorService Callable example.
Learn to use ExecutorService invokeAny() method where we execute multiple tasks at same time, but we make a decision asap any one of tasks is completed.
Learn to handle tasks which are submitted to Executor and are rejected because the executor has been shutdown for any reason using RejectedExecutionHandler. 1. When tasks get rejected Remember when we finish the execution of an executor, we use the shutdown() method. The executor waits for the completion of tasks …
Learn to use Java ExecutorService to execute a Runnable or Callable class in an asynchronous way. Also learn the various best practices to utilize it in most efficient manner in any Java application.
Learn to compare two LocalDateTime instances to find out which date represents an older timestamp in comparison to other timestamp. LocalDateTime class is part of java.time package added in Java 8.
Learn to compare two LocalDate instances to find out which date represents an older date in comparison to second date. LocalDate class is part of java.time package added in Java 8.
The AtomicInteger class protects an underlying int value by providing methods that perform atomic operations on the value. It shall not be used as a replacement for an Integer class.
Learn to format date and time in either 12 hours pattern. The formatted date string will have the AM/PM information as applicable to the timestamp.
Java examples to format LocalDate to String using inbuilt and custom patterns using FormatType and format(formatter) API.
Java programs to find if a given year is a leap year using new Java 8 APIs (LocalDate and Year), legacy Java 7 GregorianCalendar, and custom code.
Learn to compare two instances of ZonedDateTime either in the same timezone or in different timezones in Java 8. 2. Comparing at Same Instant As we know an instance of ZonedDateTime is a point in the universal timeline with an offset. So to compare two such instances, logically, both instances …
Learn to format a ZonedDateTime to string using ZonedDateTime.format (DateTimeFormatter) method in Java 8. Convert ZonedDateTime to String example.
Learn to convert from LocalDate to ZonedDateTime and from ZonedDateTime to LocalDate in Java 8. As we know, LocalDate represents a calendar date without the time and the zone information. ZonedDateTime instance contains all three information i.e. date, time and zone. ZonedDateTime = LocalDate + time + timezone 1. LocalDate …
Learn to convert from LocalDate to LocalDateTime and from LocalDateTime to LocalDate in Java 8.
Java 8 ZonedDateTime class represents an instant in the universal timeline with the timezone information. In this tutorial, we will learn to parse a string to ZonedDateTime object using its parse() method. 1. Parsing a Date Time with ZonedDateTime.parse() Java program to convert a given string into ZonedDateTime instance. After …