Thread.sleep() method in Java: The two variations of the sleep() method are available from the Java Thread class. The first one only takes one argument, whereas the other variant takes two. To stop a thread from working for a specified period of time, use the method sleep(). The length of time the thread spends sleeping […]
July 5, 2022 | Java | No comments
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
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
In Java, the final keyword is used to restrict the user. The final keyword in Java can be used in a variety of situations. Finally, you could say: variable method class The final keyword can be used with variables to create a final variable with no value. It’s also known as an uninitialized final variable […]
May 28, 2022 | Java | No comments
In Java, the static keyword is mostly used to control memory. It is also used to share a class’s identical variable or method. Static keywords can be used with variables, methods, blocks, and nested classes. The static keyword refers to a class rather than a specific instance of that class. A constant variable or a […]
May 28, 2022 | Java | No comments
this is a Java keyword that refers to the current object of a class. Uses of this keyword: The following are some examples of how to utilize this keyword: this can be used to refer to the current instance variable of a class. this can be used to call the method of the current class […]
May 27, 2022 | Java | No comments
In Java, there are numerous distinctions between method overloading and method overriding. The following is a list of the differences between method overloading and method overriding: No. Method Overloading Method Overriding 1) To make the program more readable, method overloading is used. Method overriding is used to provide a specific implementation of a method that […]
May 25, 2022 | Java | No comments
In Java, method overriding occurs when a subclass (child class) has the same method as the parent class. Overriding is a feature that allows a subclass or child class to implement a method that is already provided by one of its super-classes or parent classes. When a subclass’s method has the same name, parameters, signature, […]
May 21, 2022 | Java | No comments
Method Overloading in Java: Method Overloading occurs when a class has multiple methods with the same name but different parameters. Compile-time (or static) polymorphism is linked to overloading. The readability of the program is improved by method overloading. We don’t have to develop new names for functions that do the same thing. Overloading the method […]
May 21, 2022 | Java | No comments
Modifiers in Java are divided into two categories: access modifiers and non-access modifiers. The accessibility or scope of a field, method, constructor, or class is defined by the access modifiers in Java. The access modifier can be used to change the access level of fields, constructors, methods, and classes. Types of access modifiers: There are […]
May 14, 2022 | Java | No comments