Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static

 
Sant
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any possible declaring the static variable in staic method
 
Jay Pawar
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a sample code and check the explanation given by compiler.
 
satya mahapatra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it is possible. because main is also a
static method and we can declare static variable
inside main.
 
John Brown
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not possible to declare a static variable inside any type of method because the only legal modifier for local variables is "final".
 
satya mahapatra
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yah john is right.it is not possilble to
declare except final anythin inside a
method not in even main method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic