Category: 02. JAVA OOPs
-
Java – Constructors
Java Constructors Java constructors are special types of methods that are used to initialize an object when it is created. It has the same name as its class and is syntactically similar to a method. However, constructors have no explicit return type. Typically, you will use a constructor to give initial values to the instance variables defined by the class or to…
-
Java – Variable Scopes
The variable’s scope refers to the region where they are created and accessed in a given program or function. The variable scope also refers to its lifetime. In this tutorial, we will learn about the scopes of the different types of Java variables. Scope of Java Instance Variables A variable which is declared inside a class and outside…
-
Java – Methods
Java Methods A Java method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println() method, for example, the system actually executes several statements in order to display a message on the console. In this tutorial, we will learn how to create your own methods with or without return values, invoke…
-
Java – Class Methods
Java Class Methods The class methods are methods that are declared within a class. They perform specific operations and can access, modify the class attributes. Creating (Declaring) Java Class Methods Class methods declaration is similar to the user-defined methods declaration except that class methods are declared within a class. The class methods are declared by specifying the access modifier followed by the return type, method_name,…
-
Java – Class Attributes
Java Class Attributes Java class attributes are the variables that are bound in a class i.e., the variables which are used to define a class are class attributes. A class attribute defines the state of the class during program execution. A class attribute is accessible within class methods by default. For example, there is a class “Student” with…
-
Java – Object and Classes
Java Classes and Objects Java is an Object-Oriented programming language. In Java, the classes and objects are the basic and important features of object-oriented programming system, Java supports the following fundamental OOPs concepts – In this tutorial, we will learn about Java Classes and Objects, the creation of the classes and objects, accessing class methods, etc. Java Classes A class is…
-
Java – OOPs (Object-Oriented Programming) Concepts
OOPs (Object-Oriented Programming System) Object means a real-world entity such as a mobile, book, table, computer, watch, etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts. In this tutorial, we will learn about the concepts of Java (OOPs)…