Explain about global variables in Java?

Answer Posted / niranjanravi

Global variables are not possible in java because the
concept of Encapsulation is eliminated here.it is not in
the main() method where we declare variables.

Is This Answer Correct ?    5 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print count of empty strings in java 8?

523


What is a variable and constant?

533


What is the purpose of a volatile variable?

541


What are the advantages of compiled language?

562


Can main() method in java can return any data?

627






Why string is immutable with example?

518


What is the difference between a field variable and a local variable?

558


Is multiple inheritance supported by java?

492


What do you understand by private, protected and public?

509


What is use of map in java?

501


How to write custom exception in java?

591


There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?

980


Is there any difference between nested classes and inner classes?

522


Can you achieve runtime polymorphism by data members?

569


How do you sort a set in java?

504