Friday, August 28, 2015

Class n Object

After giving you some information about the basic terms,now its time for some detailed information.
The first and foremost thing you need to remember is that Java is an OBJECT ORIENTED PROGRAMMING LANGUAGE.
Now according to the terms in my previous post, the technical definition of an object is that "It's an instance of class" and that "class is a blueprint from where object is created". Now maybe some of you know these definitions but there are others who may have no idea what am i talking about.
So let me tell you in  a simpler way.

Ok.. just imagine that you need to build a house. Now before building a house..what do you need?
A Map of the house or you may say a blueprint. A blueprint is not the real house but the map of how to make the real house.
Just like this in Java Program, A class is always a blueprint from where we create an object(real thing). Let me give you an example: (just try and practice)
 House.java
public class House     // this is a class called House(Blueprint)
{
String houseaddress;
House(String houseaddress){
this.houseaddress=houseaddress
}
public String getHouseaddress() {
return houseaddress;
}

main.java(the program is executed here)
public class main {
public static void main(String[] args)
{
House object = new House("California");
// whenever 'new' is used just know that a object is created
object.getHouseaddress();

System.out.println(object.getHouseaddress());
}
}





Wednesday, August 26, 2015

Basic Terms in Java

Below are some critical terms necessary to understand Java Programming Language. Make sure you go through all of them..

Variable :The primary way programming languages store state.

Method:A way of doing something: A programmer-defined expression. Takes inputs, does actions, and then returns outputs.

Type + Name:The general way of declaring something in Java.

Class:A blueprint for a type of object; a user-defined type of object. In a car metaphor, a engineers' blueprints and designs for a car.

Instance:A member of a class; an object. In a car metaphor, a physical, drive-able car, which may differ in state and behavior from other cars.

Constructor:A special kind of method that initializes a newly created object. Its return type and name are combined, and must be the name of the class in which this special method is declared.

Object-Oriented Paradigm:

The programming paradigm that holds that "computers can model any relevant task as interactions among a system of objects"

Object:

Something that has state and behavior. Interchangeable with "instance of a class.

Reference:The location of an object in memory; the way Java "stores" large objects in small variables


Primitive Type:The eight, frequently used types in Java that, for optimization purposes, are NOT objects. These are the only types that are lower case.(byte,short,int,long,float,double,boolean,char)

Declaration:The process of telling the compiler that the programmer is defining something new.

Compiler

The "middle-man" between programmer and computer that converts high-level, human-readable code into machine code.

Tuesday, August 25, 2015

Your first program

Being a programmer there is one thing you need to do WRITE CODE and the more you write.. the more perfect you get.
In this section, my plan is to lead you into the world of Java programming by writing a simple program. As with any application, you need to be sure that Java is properly installed on your computer(Follow the steps of my previous post).
I have written a HelloWorld example below. I can understand if you can't understand a bunch of things right now but you sure will. For now if you are ready with your Eclipse, just go and type this in your screen.After writing, just right click your button and you can see RUN AS and when you hover there comes a button like  "1 Java Application", just click that and you are good to go.
  1. //Java Hello World example.
  2. public class HelloWorldExample{
  3.   public static void main(String args[]){
  4.      //Use System.out.println() to print on console.
  5.    
  6.     System.out.println("Hello World !");
  7.   }
  8. }
  9. //OUTPUT of the above given Java Hello World Example would be :
  10. Hello World !

Saturday, August 22, 2015

My Story(just a tad.. :) )

A little

After giving you basic guidance towards Java, i wanted to share something about how i ended up in a technical field and how i even started writing a BLOG about it!
Well here is how it happened..
I had just finished my high school and as usual was looking  for a college to start my bachelors.I had no idea about which subject to pursue and i was looking at every website to find out what would be the best for me.But my bad..i could find NONE !
Then after a long period i came across a course called IT..I think everyone of you know about it.. and if you happen to not know, it's Information technology.Then i decided this was it.
After 3 years i completed my bachelors in Bsc.IT. Then my long journey of learning programming language started ... First it was PHP,then came Dot NET . I also tried my hand in Website Designing but none worked out.
Back to back everything i learned started crumbling down. I didn't know what to do now. i even got to the point where i thought of changing my field of study until i came across JAVA!!

Getting Started!

Lets start with the installation process of Java.As Java is an open source programming language, you can easily find it and download it in your system.

Installation/Setup

Java can be written with any text editor, as Java is a compiled language. This is a detail we’re going to skip, because understanding this will not help us to get Java working, nor even tell us how to program in it. We want to install Java first, and that's exactly what we're going to do.
What I recommend is to download Eclipse. Eclipse is much more than a simple text editor, and the version I recommend that you get comes with Java's Development Kit already so there’s little setup. Just follow these easy steps:
This will install Java on your machine. Get the version you need. Most of you probably have Windows, so you'll want to choose one of the Windows downloads. If you happen to have Solaris or Linux, you'd have to get one of those. For those of you on a Mac, guess what? You already have Java! So you can skip this step.
Visit this link : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Make sure you follow the instructions!!
2. Then go and download Eclipse
Follow the link to go to the Eclipse downloads page
https://eclipse.org/downloads/


Entering Java World.

The Java Programming language is easy to learn, whether you're totally new at programming, or just want to pick up a new language. It is the perfect computer language for being competitive in today's industries or even to create programs as a hobby.

Don't know anything about Java? Don't know anything about programming a computer? I don't think that should stop anyone from learning. Java can be simple with proper guidance, and I believe programming can be a great asset to anyone.
This is truly Java for beginners, so you do not need to know how to program at all! Even if you do know a different language, this introduction to Java will help you get started to learn Java quickly so you can begin coding right away.I have tried to guide you through the process of learning Java. Start your introduction to Java with the installation and work your way through basic Java commands so you get used to working with the language.

We want to get started off on the right foot, so we'll be learning the basics in a program called Eclipse. Don't worry, the program is free, and it will help you to use Java the way that professionals do.
I strongly encourage you to work through the examples, and also to read through as fast or as slowly as you like. Feel free to come back to make sure you've nailed the concepts or if you need some clarification.
Good luck!