Posts

Showing posts from March, 2023

Inheritance

Image
  Inheritance What is the meaning of Inheritance ? Simply,inheritance is owning or belonging something/s from one person/generation to another person/generation.It may be anything. What is Inheritance in JAVA ? Taking the things/properties in one JAVA class to another JAVA class is called as Inheritance . What are two categories of Inheritance Concept ? sub class (child) - the class that inherits from the initial class. super class (parent) - the class that is used to inherit other classes. How do we inherit one class from another class ? First of all we should create a relationship between 2 classes. For that,we use the keyword  extends . If we consider the process of manufacturing a new car as an example, that car may contain newest features and it will include the   features of its previous version. So, the oldest version can be identified as the super class and the modern version will be the sub class. The older version has a colour,name,lights,..etc.Actually they're...

Method Overloading in JAVA

Image
Method Overloading  Method Overloading Concept is used in JAVA when there are many methods inside the source code with the same name in the same class. A JAVA code will have multiple methods with the same name while its parameters are different. We can do method overloading by changing the parameter. It is known as Method Signature . So multiple methods can have same name with different parameters. We should pass relevent agruments to the parameter when the method is being called. Consider the following methods. void one() { } void one(String a) { } void one(int x) { } void one(float x,float y) { } We can see there are 4 methods with the same name but with different parameters. Now you can call them by giving suitable arguments. one (); one ("hello world !"); one (567); one (56.9,45.3); Simply, this is the way of using many methods with the same name in a same JAVA class in programming. I think you all are able to understand how to use Method Overloading Concept in JAVA. S...

Parameters,Arguments & Constructor

Image
 Parameters and Arguments Today we're here to discuss about parameters and arguments in JAVA. Let's look at it by studying the above example. Parameter is there to keep inputs and outputs. Information can be passed to a method by using parameter list. Parameters act as variables inside a method. We can add many Parameters by seperating with commas. When a   parameter is passed to a method,it is called an argument. Arguments in JAVA are actually the values that are passed to the variables in a method. Return type is used to return the output. In JAVA, the default return type is "void".It can return any data type or String value. And also String or any data type can be used as the return type.But we must use the "return" keyword inside the method. eg:- 1) int area (int x,int y){         int z=x*y;         return z;         System.out.print(z);         }         area (7,13); ...

Object Creation and Data types in JAVA

Image
  Object Creation and Data Types in JAVA + In JAVA,we can generate an object if only there is a class. + Object is created from a class. + And also only a class can be converted into an object. + Everything in JAVA is based on objects and classes along with its arrtibutes and methods. + Let's see how to create an object step by step. 👉  Create a Class public class Main {    int x=5; } 👉  Create an Object public class Main{    int x=5;    public static void main(string[]arg) {         Main obj = new Main();         System.out.println(obj.x);    } } Data Types Formats or types that are being used to keep data are "Data Types". In JAVA,a variable must be written with a specified data type that is suitable to it. Data types are divided into 2 parts. (i) Primitive data types byte(integer) char(integer) short(integer) int(integer) long(integer) float(floating point) double(floating point) boolean(...

An Introduction to JAVA

Image
An Introduction to Java In this article we'll seek into following keypoints. What is JAVA ? OOPC (Object Oriented Programming Concept) JAVA Standards Operators in JAVA Class & Object 1. What is JAVA ? JAVA is a high-level,general purpose and powerful programming language. It is object oriented language and mainly based on OOPC (Object Oriented Programming Concept). JAVA is machine independent. It was developed at Sun MicroSystems which was purchased by Oracle in 2010. JAVA is used to develop software that can run on mobile,desktop and servers. 2. OOPC (Object Oriented Programming Concept) As you know,an object is referred to anything in this world. in JAVA hierachy,object is at the top of the positions and that's why it is called "Object Oriented Language". In simply,Object Oriented Programming is a concept that uses  objects for programming. It basically implements real world entities to programs. Now-a-days OOPC makes proramming an easy task than earlier. In ear...