Home » Core Java (page 5)

Core Java

Java 11 New Features Tutorial

In this tutorial, I will talk about the JDK 11 product changes. Then I will dive into several API changes with Java examples. Finally I will show the new Single-File Launcher, which executes a Java source file without going through the compile processing. Table Of Contents 1. Introduction 2. Install JDK11 3. Technologies Used 4. Change at java.lang.String 5. Change ...

Read More »

Java 11 String Class New Methods Example

In this example, we will discuss the new methods of the String class introduced in Java version 11. 1. Introduction Every Java release comes with some new features.  Many of the features arise from inconsistencies of earlier releases.  Others are due to the ever-changing landscape of technology.  In this article, we will cover the new methods that were added to ...

Read More »

Java String charAt() Method with Example

1. Introduction The java.lang.CharSequence interface provides read-only access to many different kinds of char sequence. It has provided a charAt method since version 1.4 to return the character value at the specified index. java.lang.String class implements java.lang.CharSequence. The string indexes start from zero to the string’s length() minus one. Here is the method syntax: char charAt(int index) Parameters: index – ...

Read More »

Java String contains() method with Example

1. Introduction The java.lang.String class represents character strings. It has provided a contains method since version 5 to return true if and only if this string contains the specified sequence of char values. Here is the method syntax: boolean contains(CharSequence s) A CharSequence interface represents a readable sequence of char values. It has five implementation classes: java.nio.CharBuffer, javax.swing.text.Segment, java.lang.String, java.lang.StringBuffer, ...

Read More »

Java Decorator Design Pattern Example

1. Introduction to Java Decorator Design Pattern In this article we will discuss Java Decorator design pattern in detail. The decorator design pattern is often used to alter an object’s features at run time. Simultaneously, it would not impact other instances of the very same class, therefore the behaviour of each object is altered. The java Decorator design pattern is ...

Read More »

Java String trim() method with Example

1. Introduction The java.lang.String class represents character strings. It provides a trim() method since version 1.4 to return a new string object whose value is the copy of the original string without any leading or trailing white-space. Note: a white-space is when the ASCII code of the character is less than or equal to the space character, which is \u0020. ...

Read More »

Java Interpreter Design Pattern Example

1. Introduction to Java Interpreter Design Pattern The interpreter design pattern is one of the behavioral design patterns that indicate how the words can be evaluated in a language. For an example, we will take one of our day to day used application Google Translator. Google Translator is an Interpreter design pattern example, in which the input can be read ...

Read More »

Java Command Design Pattern Example

1. Introduction to Java Command Design Pattern In this post, we will discuss the concept java Command design pattern. The command design pattern is one of the behavioral design pattern in object oriented programming where the object is used to hide the information that is necessary to carry out an action or to activate events later. This data involves the ...

Read More »

Java Strategy Design Pattern Example

1. Introduction to Java Strategy Design Pattern In this article, we will elaborate java Strategy design pattern in detail which is one of the important behavioral design pattern. The Strategy design pattern is also referred to as a policy pattern which allows the selection of an algorithm at runtime as needed. We define several algorithms or strategies in the java strategy ...

Read More »

Java State Design Pattern Example

1. Introduction to Java State Design Pattern In this article, we will introduce java state design pattern in detail. The java State design pattern is one of the behavioural design pattern. When an object changes its behavior based on its internal state, the State design pattern is used. So, we create objects in a State design pattern that represent different ...

Read More »