Friday, October 25, 2019

What is Inheritance ? | Concept of inheritance in JAVA | JAVA Programming

What is Inheritance ? | Concept of inheritance in JAVA | JAVA Programming

What is Inheritance ? | Concept of inheritance in JAVA | JAVA Programming




What is Inheritance?


In this article we learn about inheritance in java with the help of simple examples.


Inheritance is the one of the part of or key features of object oriented programming (OOP) which allows us to define a new class from an existing class.

Example:

class Birds
{
          // eat() method
          // sleep() method
}
class Parrot extends Birds
{
          // fly() method
}


In Java Programming, we can use the extends keyword to inherit from a class.


Here, we have inherited the parrot class from the Birds class.


The Birds is the super or parent class and the parrot is a subclass or child class.


The subclass inherits the fields and methods of the super class.




is-a relationship


Inheritance is the one type of is-a relationship. We can use inheritance if and only if an is-a relationship is present between two classes.

Example:

A mango is a fruit.
A bus is a vehicle.
A parrot is a bird.
A cat is a animal.
A Neem is a tree.
A fan is an object.


Example of JAVA Inheritance:

class Birds
{
          public void eat()
          {
                    System.out.println( " I can eat " );
          }
          public void sleep()
          {
                    System.out.println( " I can sleep " );
          }
}

class Parrot extends Birds
{
           public void fly()
           {
                     System.out.println( " I can fly " );
           }
}

class main
{
          public static void main ( string[ ] args )
          {
                    Parrot.parrot1 = new Parrot();
                    
                    parrot1.eat();
                    parrot1.sleep();

                    parrot1.fly();
          }
}

Output:

I can eat
I can sleep
I can fly


In this example we have inherited a subclass Parrot from superclass Birds. 

The Parrot class inherits the methods eat() and sleep() from the Birds class.

So, object of the Parrot class can access the members of both the Parrot class and the Birds class.



Types of inheritance


There are five types of inheritance.

1. Single inheritance:

In this type of Inheritance Class B applies only to Class A.


2. Multi-level inheritance

In multi level inheritance class B extends class A;  then class C extends from class B.

 3. Hierarchical inheritance: 

In Hierarchical inheritance Class A acts as a superclass for classes B, C and D.


 4. Multiple inheritance:

In Multiple inheritance Class C extends from interfaces A and B.

 5. Hybrid inheritance

It is a combination of two or more types of inheritance.


Java programming should not support multiple and hybrid inheritance through classes. Also we can get multiple legacy in Java via interfaces.



Why use inheritance?

The most important use is the reuse of the code. The code in the parent class does not need to be rewritten in the child class.

To get run-time polymorphism by overloading a method.  We will learn more about polymorphism in future article.

Wednesday, October 23, 2019

What is OOPS ? | Concept of OOPS | JAVA programming

What is OOPS ? | Concept of OOPS | JAVA programming

What is OOPS ? | Concept of OOPS | JAVA programming


JAVA programming

What is OOPS?

Object-oriented programming is a programming concept based on the principle that objects are the most important part of your program.  


Lets users create the desired objects and then create methods to manage those objects.  Handling these objects for results is the goal of object-oriented programming.


Object-oriented programming, better known as OOP, is used in a modern programming language such as Java.


The basic concepts of OOPS are

(1) Class


The class is a group of similar entities.  It's just a logical component and not the physical entity.  

For example, 

if you have a class called Costly Cars, it may include items such as Mercedes, BMW, Toyota, etc.  Their characteristics (data) can be the price or the speed of these cars.  While methods can be done with these cars, drive, reverse, brake, etc.


(2) Object


An object can be defined as an instance of a class and a program can contain multiple instances of a class.  


An object contains both the data and the function that works with the data.  

For example

chair, bike, marker, pen, table, car, etc.


(3) The Inheritance


Inheritance is an OOPS concept in which an object captures the properties and behavior of the parent object.  

A parent-child relationship is established between two classes.  It provides a robust and natural mechanism for organizing and structuring any software.


(4) Polymorphism


Polymorphism refers to the ability of a variable, object, or function to take many forms.  

For example, 

In English, the verb has a different meaning when you use it with a laptop, a race and a company.  


Here we understand the term meaning based on the other words used together with term.  The same is true for polymorphism.


(5) Abstraction


An abstraction consists in presenting the essential characteristics without taking into account the details of the background. This is a technique for creating a new data type that is suitable for a particular application.  

For example, 

If you drive a car, you do not have to worry about internal work.  Here, you only need to worry about parts such as the steering wheel, the transmission, the accelerator pedal, and so on.


(6) Encapsulation


Encapsulation is a OOP technique for encapsulating data and code.  In this OOPS concept, variables in one class are always hidden from other classes.  


It could only be accessed using the methods of their current class.  


For example, 

At school, a classless student can not exist.


(7) Association


Association is a relationship between two objects.  It defines the diversity between objects.  


In this OOP concept, all objects have a distinct life cycle and there is no owner.  


For example, many students may be assigned to one teacher, while one student may be assigned to more than one teacher.


(8) Aggregation


In this technique, all objects have their own life cycle.  However, there are property rights so that children can not belong to any other parent.  


For example, consider the class / object department and the teacher.  Here, only one teacher can not belong to more than one department, but even if we delete the department, the teaching object is never destroyed.


(9) composition


A composition is a particular form of aggregation.  It is also called "relationship of death".  Child objects do not have a life cycle.

If the parent object deletes all child objects, they will also be deleted automatically. Take an example of the house and the room. Each house can have several rooms.  


A room can not be part of two different houses.  So if you delete the house, the room will also be deleted.


Benefits of OOPS:


✓ OOP provides a clear and easy-to-understand modular structure for programs.

✓ Objects created for object-oriented programs can be reused in other programs. This saves considerable development costs.

✓ Large programs are hard to write, but if the development and design team follows the OOPS concept, they can design better with minimal errors.

✓ This also improves the modularity of the program because each object exists independently.

Friday, October 18, 2019

Java Programming interview questions

Java Programming interview questions

Java Programming interview questions


Java Programming Interview Questions

Here we provide most asked interview questions which is more helpful to crack  any interview of java programming.


1. What is JVM?  Why is Java called a platform-independent programming language?Guess?


Ans.


A Java Virtual Machine (JVM) is a virtual process engine that can execute Java bytecode.  


Each Java source file is compiled

into a bytecode file executed by the JVM. Java has been designed to enable the creation of application programs that are possible
Run on any platform without the programmer having to rewrite or compile it for each platform.  

A virtual Java Machine makes this possible because it knows the specific command lengths and other peculiarities of the underlying Hardware platform.




2. What are the difference between JDK and JRE?


Ans.


The Java Runtime Environment (JRE) is basically the Java Virtual Machine (JVM) that runs your Java programs.


It also contains browser plugins for running applets. The Java Development Kit (JDK) is fully functional software development Kit for Java, including JRE, compilers and tools (such as JavaDoc and Java Debugger for a user to develop and compile Run Java applications.




3. What does the keyword "static" mean? Should we override private or static Method in Java?


Ans.


The static keyword indicates that a member variable or method can be accessed without requiring instantiation of the class what it belongs.  A user can not override static methods in Java because overriding methods is based on dynamic binding.


Runtime and static methods are statically bound during compilation. The Static method is not associated with any instance of a class

So the concept is not applicable.



4. Can you access non-static variables in the static context?


Ans.


A static variable in Java belongs to its class and its value remains the same for all instances.  A static variable is initialized

when the class is loaded by the JVM.  

If your code attempts to access a non-static variable without an instance, the compiler will do it Complain because these variables have not yet been created and are not associated with any instances.

Sunday, October 13, 2019

What is cloud computing ?

What is cloud computing ?

What is cloud computing ?

The technology moves more and more into the cloud.  It is not just a fad, the shift from traditional software models to Software as a Service has steadily gained momentum over the past 10 years.

Looking ahead, the next decade of cloud computing promises even more opportunities to collaborate from anywhere with mobile devices.

What is cloud computing
What is cloud computing ?

What is Cloud Computing?


Cloud computing is essentially a kind of outsourcing of software, data storage and processing. Users access applications and files by signing in from any device that has an Internet connection.

Information and programs are hosted by third parties and are not on the user's hard drive but in a global network of secure data centers.

This saves computing power, facilitates sharing and collaboration, and enables secure mobile access, no matter where the user is or what device is being used.

Cloud computing is a more efficient way to deploy computer resources.  In cloud computing, software and service environments are based on subscriptions-users pay a monthly fee instead of buying licenses.

Software and platforms are maintained by providers and continually updated to ensure maximum performance and security.

Computing power is not central, but decentralised, so users can leverage additional capacity when business issues arise.  Multiple people can access a shared program or file and collaborate in real time from multiple locations.

Younger employees have a hard time imagining that employees could only access work files, messages, and systems connected to other computers on the network by physical cables from a single terminal in the office in a given time.  

The software had to be manually installed on each computer.  Company data was stored on large machines in a room or cabinet that had to be well ventilated to prevent overheating.  The loss or failure of a single device can be catastrophic.

Cloud computing has optimized or eliminated many previous Office features:


Large server companies no longer need to place server benches in well-ventilated cabinets or equipment rooms.

  • Dedicated in-house IT support - 

Technology talents continue to be valued, but companies no longer need corporate staff to troubleshoot their hardware and software systems.  Cumbersome tasks such as updating computers one by one have been eliminated.

  • Data Storage Devices - 

Employees do not need to back up data on hard drives, discs, or external devices manually.

  • Limited geographic access - 

Employees and managers are no longer tied to the office.  You can be just as productive on the move or remotely as in the corporate office.  Access to processes and information is not tied to a specific geographic location.

  • Outdated Standard Software - 

Software updates required significant spending every few years to buy the latest version of important programs.  Applications had to be manually installed and maintained on each device.  

Only the largest companies could hire developers to create custom software.  Bugs and security issues may not be resolved for years.

  • Loss of Information - 

Managers feared that in an emergency or natural disaster, all company records could be deleted.  Data stored locally on office computers is prone to loss or failure.  However, data stored in the cloud is protected multiple times.

  • Duplicate Document Versions -

Employees no longer need to e-mail files because one person makes changes and different versions of work products are stored locally on multiple devices.  

Cloud-based shared files are always up to date. Colleagues can be sure that they all see the same and work with the same information.

In the Traditional business applications have always been complicated and expensive. The amount and variety of hardware and software required to run them was tremendous. 

Businesses needed a whole team of experts to install, configure, test, run, secure, and update.

If you spread that effort across dozens or hundreds of apps, it's easy to see why in the past, only the largest companies with the best IT departments received the custom solutions they needed.  

Small and medium businesses did not stand a chance.  Advances in cloud computing have changed this.

Cloud computing: 

Cloud computing eliminates the headaches associated with storing your own data by not managing hardware or software.  This is the responsibility of an experienced provider like Salesforce.  

The shared infrastructure works like a utility: you only pay for what you need, upgrades are automatic, and scaling is easy.

Cloud-based apps can run in days or weeks and cost less.  With a cloud app, you simply open a browser, log in, customize the app, and start using it.

Why cloud computing is better:


  • Accessible from anywhere - 

applications and data are not tied to a device. They are accessible from any location and allow remote teams to collaborate in real time.

  • Flexible and Scalable - 

Cloud-based applications are infinitely customizable.  It's easy to increase performance, storage, and bandwidth as users' needs change.

  • Affordable - 

Companies pay only for what they consume, usually per month per seat.  There is no hardware that consumes 24/7 space and consumes power.

  • Hassle-free updates - 

The web-based software is constantly updated.  The provider takes care of maintenance, backups and troubleshooting.

Fast service is delivered on demand through a global network of secure data centers that are constantly updated to provide maximum efficiency and performance.

  • Safe - 

Information is not prone to flooding, fires, natural disasters, or hardware outages in one place.  Security logs and infrastructure are constantly being analyzed and updated to meet new threats.

Businesses run all kinds of apps and many things in the cloud, such as:  B. Customer Relationship Management (CRM), human resources, accounting and much more.

Salesforce was a pioneer in delivering cloud-based software.  Some of the world's largest companies have moved their applications to the cloud with Salesforce after thoroughly testing the security and reliability of our infrastructure.

A word of caution

As cloud computing becomes more popular, thousands of businesses simply rename their non-cloud products and services as "cloud computing." 

As you evaluate cloud offerings, think deeper and remember that you need to buy and manage hardware and software what you are looking for is not really cloud computing but a bad cloud.

  

Tuesday, October 8, 2019

What is JAVA ? | History Of JAVA | Features Of JAVA

What is JAVA ? | History Of JAVA | Features Of JAVA

History of Java / Core Java


JAVA Programming Language



Java Programming Language, was invented by James Gosling under Sun Microsystem company.


But both Mike Sheridan and Patrick Naughton have a big stake in making Java language.  In all three, 'James Gosling' played an important role.


Java language was originally created for the interaction of Television.  But currently this language proved to be very important and in future its importance will increase even more.


Java was first named 'Oak' from this tree.  This means 'James Gosling' and his co-workers used to work for Java, there was 'Oak' tree and 'Oak' is also the national tree of many countries.  That's why it was named 'Oak'.


This 'Oak' was named in 1991.  But this 'Oak' name was already from 'Oak Technologies'. After that, 'Oak' was renamed 'Java'.


Java was the only reason to name it, that when 'James Gosling' and his co-operatives worked, they used to drink Indonesian coffee of 'Java' seeds and the name 'Java' was quite new too.  That's why Java was named.


In 2010, Sun Microsystem sold it to 'Oracle'.


When java started, its first specimen came in '1995'.



All versions of Java are shown below.



Java versions
JAVA versions



Introduction for Java / Core Java



What is java


Java is a very popular programming language worldwide.

Three variants have been created for Java.

✓ Java SE (Standard Edition)

✓ Java EE (Enterprise Edition)


✓ Java ME (Micro Edition)


1. Java SE

Java SE is used for Basic Programming, also known as Core Java.

2. Java EE

Java EE is Advanced Programming, it is also called Advanced Java.

3. Java ME

Java ME is suitable for mobile programming, but it has no relation with android.


Java was made free when it was launched and will remain free in present and future.  


Another importance of Java is Write Once, Run Anywhere, which means it is run on any mobile-based, windows-based and web-based application.



Java features



Features Of JAVA


Java is designed for Programming with many features.

 Like,

✓ Simple

✓ Secure

✓ Object-oriented

✓ Independence

✓ Portable

✓ Robust

✓ Interpreted

 ✓ Multitreaded

 ✓ High performance

✓ Distributed


Simple: 



This is somewhat similar to Language C ++.  Any user who gets good knowledge from C ++, also has no problem in learning Java.



Secure: 



It is more secure than Language C and C ++.  This is Language virus-free Language.



Object-Oriented: 



It is Language Class-based and Object-based.



Independent: 



It is independent language, if you want to build a software, then it does not need anything.


Portable: 



This language can be run on any platform.



Robust: 



This language and its memory management are very strong.



Interpreted: 



This language is an interpreted language.



Multitreaded:



More than one program can be run simultaneously in this language.



High Performance: 



Compilers of Java do not take much time for program execution, hence it is considered a high-performing language.



Distributed: 



The program created by Java is distributed from one computer to another.

Saturday, October 5, 2019

Introduction to Programming Language | Various Types of Programming Language | Computer Science Technology

Introduction to Programming Language | Various Types of Programming Language | Computer Science Technology

Introduction to Programming Language | Various Types of Programming Language | Computer Science Technology


Introduction of Programming Language
Introduction of Programming Language


Introduction to Programming


Every year millions of students computer scientists are made in all over world. Although a computer scientist does not just do programming, but programming is a very important part of computer science.  


Therefore, as a beginning programmer, it is very important for you to understand the concept of programming and its related components properly.


There are so many programmers who are doing programming but they do not know the concept behind programming.  Let's try to know about it.


In simple words, programming is a process in which a programmer instructs the CPU (Central Processing Unit) to perform a task. This task can be anything like adding two numbers etc.


Programming takes a holistic look consisting of some components.

✓ Programming Language

✓ Compiler and Interpreter

✓  Programmer

These components are being described in detail below.


Programming Language


Whenever humans interact, they do so through a language. With a CPU, you also communicate through language.  


The language that programmers use to talk to the CPU is called programming language.


By the way, the CPU only understands binary language.  But it is impossible for any human to do programming in binary language.


Therefore, such programming languages ​​were created which are in simple English so that any human can easily do programming.


Doing this made programming much easier.  Now as you can see, everyone can learn to do programming by getting basic information.  But earlier this was not possible.


Types of Programming Languages


More than 256 programming languages ​​have been developed so far.  Every language has been developed for a different purpose. 

Various Types of Programming Language


According to Purpose, programming languages ​​are mainly divided into 5 categories.

  • (1) Machine Language / Machine Code

This is the code that CPU directly executes.  Machine code is in hexadecimal.  It is very close to the hardware.  It is also called low level language.


  • (2) Assembly language

Assembly language was created to make the machine code even more readable. Labels have been added to it, which makes it even easier to perform tasks.  It is also a low level language.

  • (3) High Level Language 

High level languages ​​are independent of hardware such as C, C ++, and java etc. The code of these languages ​​is not directly converted to machine code.

  • (4) System Language 

This type of languages ​​is used to manage a computer. They are used to perform low level tasks. Such as memory management, process management etc.

  • (5) Scripting Languages ​​

This type of languages ​​acts as a bridge between the system and other applications.  Such as PHP etc.


Common Programming Languages


Here is a list of some programming languages.  You may have heard about some of these before.

  • ✓ C language
  • ✓ C ++
  • ✓ Java
  • ✓ C #
  • ✓ PHP
  • ✓ Python
  • ✓ Java script
  • ✓ Pascal
  • ✓ Visual basic
  • ✓ Fortran

Let us now try to know what are compiler and interpreter.


Compiler and Interpreter


As I told you, the computer only understands binary language and it is very difficult to program human into binary.  


So a program was developed that could take instructions from programmers in the form of simple English statements and convert it to binary and pass it to the CPU. This program is called compiler.


The compiler acts like a bridge between a programmer and a CPU. You can also call it translator. A compiler performs many tasks, these are being given below.


  • ✓ Compiler syntax error checks. If a syntax error occurs, the programmer is notified about it. 
  • ✓ Converts compiler source code to machine language.
  • ✓ The compiler generates a machine executable file.


Let us now try to find out about the interpreter.

Some languages ​​use interpreter instead of compiler. Both compiler and interpreter do the same thing. The only difference is that the compiler generates machine code by compiling the entire source code together which can be completely executed at once.  


Whereas an interpreter converts the instructions into machine code and executes simultaneously.  Languages ​​uses compiler and interpreter according to your requirement.


Programmer


In the initial days people used to do programming due to interest but now it has taken the form of a job.  

A programmer is a person who has knowledge of a programming language.  

A programmer uses his knowledge to solve the real world problem with the help of programming language.