Explanation of static in c,c++,c#and core java.

Please explain me the use of static in c,c++,c#and core java using in variable and method or function with its effects

Questions by shailesh20

Showing Answers 1 - 6 of 6 Answers

nitin kale

  • Jun 5th, 2013
 

If we declare variable static in c language then we can not change the value of that variable ,if we trying to change the value it throw the run time error.

Code
  1. int main()

  2. {

  3. static int x=20;

  4. printf("%d",x);

  5.  

  6. x=50;//  here  throw  run time  error

  7. getch();

  8. }

  Was this answer useful?  Yes

ALOK SHARMA

  • Jul 2nd, 2014
 

In Java static is a keyword which provide the flexibility to use variables, method - declared as static, can be use in class without object of that object.
Example of it is main method.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions