Name Roll - No Reg - No: Public Class Int Int Static Int Int
Name Roll - No Reg - No: Public Class Int Int Static Int Int
void display() {
System.out.println("Name = "+name +" , Roll no = "+roll_no+" , reg_no
="+reg_no+" ,Section"+section);
}
//2nd programs-------------------------------
//Static Method program NOTES
/*
* 1.Static Methods belong to the entire class rather than their objects.
* 2.They can be accessed without creating objects.
* 3.They can access only static data members.
*/
public class staticMethod {
static int count=10; //note:-place static or test without static
int x;
System.out.println(x);
}
}
//--------------------------------------------------------------
//Program 3 ---------------------------------------
//Use of Static
// 23/08/2019
public class useOfStatic {
}
}
/* Advantages of Static------
1.single copy is created and used by all objects. Ex.Sections of class
*/
//Program 4----------------------
/*
*/
import java.util.Scanner;
double pi=3.14;
double r,vol;
void calculate(int r) {
vol=pi*(r*r)*h;
int radi;
radi=rad.nextInt();
v.calculate(radi);
/*
* cases such as -
* (ii).Scanner class
* (iii).Switch Case
* (iv).do while
* (v).static varible
* (vi).static memberfunction
* (vii).Constructor
*/