Wednesday , September 20 2017
Home / Programming / Java and Android software development [Part -06]: Variable Practical!!

Java and Android software development [Part -06]: Variable Practical!!

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Today we will know about the local, instance, static or class prequel.

First look at the code below

1
2
3
4
5
6
7
8
9
10
11
12
public class Variable {
    static int b=10;
    int c=10;
    public static void main(String args[]){
        int a=10;
        System.out.println(a);
        System.out.println(b);
        Variable ob=new Variable();
        System.out.println(ob.c);
    }
}

Instance variable:

We see at the number 3 above the line it’s static int b = 10; This is static or class variable.
It is in the class and out of the method. But static is written as class is the variable and the method is
main.

Static or Class variable:

We are looking at the number 2 above the int c = 10; This is the instance variable. It is outside of class and outside the method. Here square is the variable and the method is Main. Everyone understands.

Local Variable:

We are looking at the number 5 above the int a = 10; This is a local variable. It is in the method. Here is the method main. Everyone understands. Thank you. If you have trouble understanding then do.

You can see the video as helpful

 

Content Protection by DMCA.com

About demandperiod

Check Also

Java and Android software development [Part -4]: Just do the program, let’s just understand what I did. If you do not wear any university, do not learn to program, do not learn software development, you are a fool.

Starting from today’s fun days, we will start to enjoy the fun of the program …

3 comments

  1. Can I simply say what a aid to find someone who actually is aware of what theyre talking about on the internet. You positively know the best way to convey a difficulty to gentle and make it important. Extra folks have to learn this and perceive this side of the story. I cant believe youre no more in style since you positively have the gift.

  2. After examine a couple of of the blog posts on your website now, and I really like your manner of blogging. I bookmarked it to my bookmark web site list and will likely be checking again soon. Pls try my site as effectively and let me know what you think.

  3. very good submit, i certainly love this web site, carry on it

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading...