Upload files to "OOP/Java/Lab/Week7/ExampleQues"
This commit is contained in:
parent
3c665489ed
commit
6b9647add4
5 changed files with 94 additions and 0 deletions
20
OOP/Java/Lab/Week7/ExampleQues/Example3.java
Normal file
20
OOP/Java/Lab/Week7/ExampleQues/Example3.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
class Example3 {
|
||||
|
||||
static int num;
|
||||
|
||||
static String mystr;
|
||||
|
||||
static {
|
||||
num = 97;
|
||||
mystr = "Static keyword in Java";
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("Value of num=" + num);
|
||||
System.out.println("Value of mystr=" + mystr);
|
||||
}
|
||||
}
|
||||
// Last } wasn't included, but I added it.
|
||||
// Output:
|
||||
// Value of num=97
|
||||
// Value of mystr=Static keyword in Java
|
Loading…
Add table
Add a link
Reference in a new issue