Why there are no global variables in java?


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Java Related AllOther Interview Questions

What is log4j in java?

0 Answers  


public class Dog { private int weight; public int getweight(){ return weight; } public void SetWeight(int newWeight){ if (newWeight > 0){ weight = newWeight; } } } public class TestDog { public static void main(String[] args) { Dog d = new Dog(); System.out.println("Dog d's weight is " + d.getWeight()); d.setWeight(42); System.out.println("Dog d's weight is " + d.getWeight()); d.setweight(-42); System.out.println("Dog d's weight is " + d.getWeight()); } } class dog is compiled but there is an error in class TestDog when compiled and the error is with dot notations. I want to kmow why there is error in testdog class when compiled.

3 Answers  


Which is the Best institute to do academic Project in Java? Need information about institutes at Ameerpet, Hyderabad.

8 Answers  


Explain different way of using thread?

0 Answers  


why java has the size of character 2 byte ,while in c/c++ it is of 1 byte?

8 Answers   IBS,






What is stateless object in java?

0 Answers  


i heard that JVM internally contains pointers...is this true?

4 Answers   Wipro,


How do I run a project in netbeans?

0 Answers  


What are the risks in java security? : java security

0 Answers  


What is explicit casting?

0 Answers  


Why sun introduce concept of anonymous class? What is need and real life use of anonymous class

0 Answers  


Is lambda cheaper than ec2?

0 Answers  


Categories