Write a program in java to demonstrate the Static variable, Static Method, Static Block
public class StaticDemo
{
static int count=0;
int sr;
StaticDemo()
{
count++;
sr=count;
}
void showsr()
{
System.out.println("Sr. No. of object created: "+sr);
}
static void showcount()
{
System.out.println("Total No. of object created: "+count);
}
public static void main(String[] args)
{
StaticDemo.showcount();
StaticDemo obj1=new StaticDemo();
StaticDemo obj2=new StaticDemo();
obj1.showsr();
StaticDemo obj3=new StaticDemo();
obj2.showsr();
obj3.showsr();
showcount();
}
}
Output
ReplyDeletetrung tâm tư vấn du học canada vnsava
công ty tư vấn du học canada vnsava
trung tâm tư vấn du học canada vnsava uy tín
công ty tư vấn du học canada vnsava uy tín
trung tâm tư vấn du học canada vnsava tại tphcm
công ty tư vấn du học canada vnsava tại tphcm
điều kiện du học canada vnsava
chi phí du học canada vnsava
#vnsava
@vnsava
Thanks mate. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also event marketing and How 5G Will Impact the Future of Events Industry
ReplyDeleteThis is an informative post. Got a lot of info and details from here. Thank you for sharing this and looking forward to reading more of your post.
ReplyDeletetax return for self employment in barking