Let’s get our hands dirty with Java Application Development. By the end of this course, you will be able to understand and code in Java programming language. We will also be making some real-life application which I haven’t yet decided.
Now, I know there are just too many sites out there which can teach you Java and probably far better than what I am writing here. So what am I gonna do here which is different from them? Nothing.
I am only going to repeat what you have probably already read. But I will keep it short and try to make it as easy as possible.
This is part one, and I haven’t planned as for how many parts this series will have.
This tutorial is meant for complete beginners to the Programming world. This will get you an idea of how programming(not just Java) works in the shortest possible way.
This is my way of tracking my progress.
What is Java?
- Java is an OOP based programming language. OOP stands for Object-Oriented Programming. Defined further ahead.
- You can make cross-platform(including mobile) applications using Java.
- You can make web applications using Java.
How do Java works?
- Java code is written by a developer.
- The compiler reads the complete code and generates a .class file which contains the bytecode.
This .class file is like the instructions for JVM defined next.
- JVM, stand for Java Virtual Machine takes the .class file and does whatever it says.
The step 2-3 results in Java being platform independent. JVM is a system specific software and every different kind of system will have a different kind of JVM.
Things you will need.
I will simplify this for you in one step, just install Eclipse IDE. Download it from here
. It will help you setup rest.
To mention is any way you will need to download JDK(Java Development Kit) from Oracle website here
. Set the environment variables to run Java files through command prompt or link JDK folder in Eclipse. That’s it.
What is OOP?
Given that we are learning an OOP based programming language it’s natural to ask what actually is OOP?
Object Oriented Programming is a concept of programming in which we deal and do anything and everything by creating objects.
Objects are like real-world entities in the program. Like any object in real life will have certain characteristics, objects in a program is expected to carry some attributes. Like any object in real life can do something, objects in a program can also do something. For example, an Object like myDog has a dogTail as an attribute and myDog can wag his dogTail.
OOP can always be achieved with the 4 features, namely
Abstraction: which is hiding of details from the viewer. Like f I want to feed myDog I don’t need to know how his digestive system works I just have to offer myDog his food.
Encapsulation: which is binding up of certain feature and features to limit their scope of functionality. We use access modifiers like Public, Private, Protected and Default to achieve this. For example, if myDog is Public anyone can pet him, but if myDog is private and not allowed to move out of the home, only the people inside the home can pet him.
Inheritance: which is carrying the similar attributes like that of their parent. This reduces the amount of code written and makes it easier to understand. For example, if myDog has a myPuppy he will carry similar attributes like Tail, Eyes, Ears.
Polymorphism: which is different behaviour performed by the object in different situations. For example, myDog will walk slowly when I take him for a walk but run away when I let him. So the feature is same which is move() but mydog can either walk or run depending on the situation.
Every language in this world has a syntax so does a programming language like Java.
Continued further here.