-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariableTypes.java
More file actions
30 lines (18 loc) · 604 Bytes
/
VariableTypes.java
File metadata and controls
30 lines (18 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.tyss.corejava;
public class VariableTypes {
// static variables are bound to the class
static int a=10;
//instance variable are not bound to the class
int b=20;
public static void main(String[] args) {
//local variables are bound to the class
int c=30;
//local variables are directly used by the method itself
System.out.println(c);
//static variables are used by the class name within the class
System.out.println(a);
//instance variables are used by creating the object
VariableTypes abc=new VariableTypes();
System.out.println(abc.b);
}
}