Posts

Showing posts from December, 2016

Lesson 7 :- Types of Methods.

Image
In the previous lesson, I told about method calling. Now I'm going to distribe types of methods. There are three types of methods. They are,                                                  1.Dumb method                                                  2.Clever method                                                  3.Smart method First of all I would like to tell below exercise to perform.     int a = 5     int b = 10 * find (a+b) Dumb method     public class Cal1{              public static void main(String[] args){     ...

Lesson 6 :- Calling a method

Image
A method is a collection of statements that are grouped together to perform an operation. A method executes when it is called. Try below example & understand what is calling a method. public class New{       public static void main(String[] args){            System.out.println("This is the main method.");            display();            System.out.println("End of the main method.");       }       public static void display(){                  System.out.println("This is the display method.");       } } If we write something under the main method , only those will execute. It means, we need to add all the things what we want to execute, under the main method. It is very basic theory in java programming language.

Lesson 5

Image
How to use NetBeans IDE In the previous lessons, we used Notepad & command prompt(cmd) to run the java codes. It is not an easy method. But we need to know that method. Otherwise we want to NetBeans or Eclipse is installed machine for coding. We can't hope that conditions everytimes. So, using cmd is better than using java IDEs. Every machines have Notepad & cmd in their operating systems. Now we are going to learn about java IDEs. I'm telling how to use NetBeans IDE in this lesson. So I also familiar with this java IDE. First of all we need to install NetBeans IDE. *** Use this link to download it. Then you can install it into your machine.               https://netbeans.org After installation, we can use NetBeans for coding. Follow these steps to run a java code. Step 1 : Open NetBeans. Step 2 ...

Lesson 4 :- Importance of user inputs.

Image
In the previous lesson, we got some numbers without using user. In the real world, the inputs are given by users. So we need to know how to get user inputs. This lesson is created to teach it. Understand about the user inputs using this code. Special things are we import a class & create an object. You can understand Scanner class and object creation by following the lesson series. import java.util.Scanner; class New{      public static void main(String[} args){            Scanner s = new Scanner(System.in);               System.out.print("Enter a String: ");       String a = s.next();       System.out.println("String is "+a);       System.out.print("Enter an integer: ");       int b = s.nextInt();       System.out.println("Integer is "+b);      } }       ...

Lesson 3

Image
We already know what is the purpose of  "System.out.println" or "System.out.print". It use to print or display what we want to display. So now we are going to identify data types in   java  programming language. They are int, double, char, String, float & boolean. We can understand the diferences among these data types later. Now I'm going to create a simple calculator. Try to do this. public class Cal{      public static void main(String[] args){          int a = 10;          double b = 5;                  System.out.println("a+b = "+(a+b));          System.out.println("a-b = "+(a-b));          System.out.println("a/b = "+(a/b));          System.out.println("a*b = "+(a*b));      } } This time we didn't use user inputs. I...

Lesson 2

Image
Follow these instructions to run your java code using cmd.                          ***Use this link to install java into your machine.               http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html                  Use the "Notepad" as your text pad.There are so many text pads like "Sublime Text2", "Notepad ++ ". Normally we use Notepad. Type our code in Notepad & save it as "First.java". Select file type as "All". Save it on the Desktop.               2. Open "cmd". Then find the location where java is installed. Go to the jdk version and open         bin file. You should copy that path. You can see like this path.                               ...

Lesson 1

Image
First java program public class First{       public static void main(String[] args){                                                   System.out.println("My First Java Code");             System.out.println("Welcome to the Java World");       } }             This is a very simple java code.First of all I need to tell all of you how to work with java.You know java is a programming language.It helps source file(human readable format) converts to class file(computer readable format). I will explain every things in next lessons.                         There are two common ways to run a java code like this.They are,                    ...