coderz.py

Keep Coding Keep Cheering!

Some examples of string class methods

The methods listed below are some of the most frequently used String class methods in Java. charAt() method: The charAt() function in a string returns the character at the specified index. Output: equalsIgnoreCase() method: equalsIgnoreCase() checks for equality between two Strings while ignoring their case. Output: indexOf() method:   The index of the first occurrence […]

June 15, 2022 | Java | No comments

String class methods in Java

Many useful methods for performing operations on a sequence of char values are available in the java.lang.String class. No. Method Description 1 char charAt(int index) It returns the char value for the given index. 2 int length() It returns the string length. 3 static String format(String format, Object… args) It returns a formatted string. 4 […]

June 11, 2022 | Java | No comments

Strings in Java

Strings are Objects in Java that are internally backed by a char array. They are immutable because arrays are immutable (they can’t grow). Every time you make a change to a String, a new String is created. An array of characters functions similarly to a Java string. Consider the following scenario: is the same as: […]

June 11, 2022 | Java | No comments

Abstract class vs Concrete class

 Following are the important differences between an abstract class and a concrete class. Sr. No. Key Abstract Class Concrete Class 1 Supported Methods Both abstract and concrete methods can be found in an abstract class. Only concrete methods are allowed in a concrete class. The class is abstract, even if it only has one abstract […]

June 11, 2022 | Java | No comments

Regular class vs static nested class

Comparison between a normal or regular class and a static nested class. S.NO Normal/Regular inner class Static nested class 1. Without an outer class object existing, there cannot be an inner class object. That is, the inner class object is always associated with the outer class object. There may be a static nested class object […]

June 11, 2022 | Java | No comments

Nested Class in Java

It is possible to define a class within another class in Java, and these classes are referred to as nested classes. They allow you to logically group classes that are only used in one place, increasing encapsulation and making code more readable and maintainable. Syntax: Note: The scope of the enclosing class limits a nested […]

June 11, 2022 | Java | No comments

Interface vs Abstract class

As we all know, abstraction refers to hiding the internal implementation of a feature and only giving the users the functionality. i.e. how it works (showing), what it does (showing) (hiding). Because an abstraction is achieved using both abstract classes and interfaces, Interface and Abstract classes are needed prerequisites. Let’s see the differences between them. […]

June 3, 2022 | Java | No comments

Interface in Java

In Java, an interface is a blueprint for a class. It has abstract methods and static constants. In Java, the interface is a means of achieving abstraction. The Java interface can only have abstract methods, no method bodies. In Java, it is used to achieve abstraction as well as multiple inheritance. Java Interface also represents the […]

June 3, 2022 | Java | No comments

Abstract Class & Method in Java

In Java, an abstract class is specified with the abstract keyword. Both abstract and non-abstract methods can be used (method with the body).Note: Abstraction is the process of hiding implementation details from the user and only displaying functionality. A class that is declared using the abstract keyword is known as an abstract class. Abstract classes […]

June 3, 2022 | Java | No comments

Sub packages in Java

The subpackage is a package within a package. It should be developed to further categorize the package. Sub packages are identical to packages, with the exception that they are defined within other packages. Sub packages are similar to subdirectories, which are directories within directories. Sub packages in themselves are packages, so you have to use/access […]

June 3, 2022 | Java | No comments

Advertisement