
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

4K+ Views
In this article, we will learn about the final parameter in Java. In Java, you can pass final variables as parameters to methods. The final keyword can be used with variables, methods, and classes to add restrictions on their behavior. What is a Final Parameter? A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to a different object. However, the data within the object can be changed. So, the object's state can be changed but not the reference. With variables, the final modifier often is used with static to ... Read More

1K+ Views
The scope of the private modifier lies with in the class. Members that are declared private cannot be accessed outside the class. Private access modifier is the most restrictive access level. Class and interfaces cannot be private. Variables that are declared private can be accessed outside the class, if public getter methods are present in the class. Using the private modifier is the main way that an object encapsulates itself and hides data from the outside world. Example The following class uses private access control public class Logger { private String format; ... Read More

1K+ Views
A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to a different object. However, the data within the object can be changed. So, the state of the object can be changed but not the reference. With variables, the final modifier often is used with static to make the constant a class variable. Therefore, once we declare a final variable it is mandatory to initialize the final variable at the time of declaration or using constructor. If not, a compile time error may occur saying “The blank final field num ... Read More

1K+ Views
Default access modifier means we do not explicitly declare an access modifier for a class, field, method, etc. The scope of the default access modifier lies within the package. When a class or its members associated with default access modifier then. Example Variables and methods can be declared without any modifiers, as in the following examples: String version = "1.5.1"; boolean processOrder() { return true; }

2K+ Views
When a variable, method or constructor that are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected, however methods and fields in a interface cannot be declared protected. Protected access gives the subclass a chance to use the helper method or variable, while preventing a nonrelated class from trying to use it. Example The following parent class uses protected access control, to allow its child class ... Read More

2K+ Views
In Python, Regular expressions are also called RegEx, which is a sequence of characters that defines a search pattern. The re module provides several functions to work with patterns in text. This is widely used in Python tasks such as string matching, validation, and manipulation. The most commonly used functions in the "re" module are re.match() and re.search(). These two methods are used to check for the presence of a pattern, but they differ in the way they look for a pattern match within a string. In this article, we are going to see the difference between the Python re.search() ... Read More

2K+ Views
Class variables also known as static variables are declared with the static keyword There would only be one copy of each class variable per class, regardless of how many objects are created from it. You can access a class variable without instantiation using the class name as className.variableName. Example Live Demo public class Test{ static int num = 92; public static void main(String args[]) throws Exception { System.out.println(Test.num); } } Output 92

825 Views
The public modifier has the widest scope. When a class or its members declared public they are accessible from everywhere. A default class or its members are available to any other class in the same package. However, if the public class we are trying to access is in a different package, then the public class still needs to be imported. Because of class inheritance, all public methods and variables of a class are inherited by its subclasses. Example The following function uses public access control − public static void main(String[] arguments) { // ... } ... Read More

883 Views
In Java, local variables are those that have been declared within a method, constructor, and block, and are only accessible within that defined scope. Such local variables are used when there is a need to store temporary data during the execution of a program. What is a Local Variable? Local variables are declared in methods, constructors, or blocks. Local variables are created when the method, constructor, or block is entered and the variable will be destroyed once it exits the method, constructor, or block. A local variable is a variable that is − Declared inside ... Read More

2K+ Views
When we haven’t initialized the instance variables compiler initializes them with default values.For boolean type, the default value is false, for float and double types default values are 0.0 and for remaining primitive types default value is 0.ExampleLive Demopublic class Sample { int varInt; float varFloat; boolean varBool; long varLong; byte varByte; short varShort; double varDouble; public static void main(String args[]){ Sample obj = new Sample(); System.out.println("Default int value ::"+obj.varInt); System.out.println("Default float value ::"+obj.varFloat); System.out.println("Default boolean value ::"+obj.varBool); ... Read More