Search This Blog

save java programs with".java" extension

examples :

helloworld.java
sample.java
match.java
send-mail.java

quick links

object in java sample program

class sample
{
int a=100,b=200;
void fun1()
{
System.out.println("i am in fun1()");
}
void fun2()
{
System.out.println("i am in fun2()");
}
public static void main(String args[])
{
int c=300;
sample s = new sample();
System.out.println("a :"+s.a);
System.out.println("b :"+s.b);

s.fun1();
s.fun2();

System.out.println("c :"+c);
}
}
==============================================
output :
a: 100
b: 200
i am in fun1()
i am in fun2()
c :300