0% found this document useful (0 votes)
3 views2 pages

Java Program: Data Types Overview

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 like myMethod(), anotherMethod(), and myOwnMethod() that print out the variable values or static text to demonstrate different variable scopes and method types. The main method creates an instance of FirstJavaProg and calls its myMethod() to output the variable values.

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)
3 views2 pages

Java Program: Data Types Overview

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 like myMethod(), anotherMethod(), and myOwnMethod() that print out the variable values or static text to demonstrate different variable scopes and method types. The main method creates an instance of FirstJavaProg and calls its myMethod() to output the variable values.

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

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;


[Link]("Integer " + x);

[Link]("Boolean " + m);

[Link]("Byte " + y);

[Link]("String " + r);

[Link]("Char " + c);

[Link]("Float " + f);

[Link]("Double " + d);

[Link]("Long " + l);

public void anotherMethod(){

[Link]("MyMethod variable ONE " + x);

public static void myOwnMethod(){

[Link]("Hello this is static method");

public static void main(String args[]){

myOwnMethod();

FirstJavaProg myObject = new FirstJavaProg();

[Link]();

You might also like