0% found this document useful (0 votes)
43 views

Asas

This Java program defines a class called FirstJavaProg that contains examples of primitive and wrapper class datatypes as global and local variables. It also contains static and non-static methods to demonstrate method calling and variable scope. The main method creates an instance of FirstJavaProg and calls its myMethod to print out the values of the global variables.

Uploaded by

riyazudheen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Asas

This Java program defines a class called FirstJavaProg that contains examples of primitive and wrapper class datatypes as global and local variables. It also contains static and non-static methods to demonstrate method calling and variable scope. The main method creates an instance of FirstJavaProg and calls its myMethod to print out the values of the global variables.

Uploaded by

riyazudheen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

FirstJavaProg.

java

package ooconcepts;

public class FirstJavaProg extends Object{

// Datatypes ---> 2

// 1. Primitive Datatype

// 2. Wrapper class

//global variable

int x;

byte y;

boolean m;

String r;

char c;

float f;

double d;

long l;

public void myMethod(){

//local variable

int one = 45;


System.out.println("Integer " + x);

System.out.println("Boolean " + m);

System.out.println("Byte " + y);

System.out.println("String " + r);

System.out.println("Char " + c);

System.out.println("Float " + f);

System.out.println("Double " + d);

System.out.println("Long " + l);

public void anotherMethod(){

System.out.println("MyMethod variable ONE " + x);

public static void myOwnMethod(){

System.out.println("Hello this is static method");

public static void main(String args[]){

myOwnMethod();

FirstJavaProg myObject = new FirstJavaProg();

myObject.myMethod();

You might also like