Java global namespace access

Given the following program:

class A {
   static int java = 42;
   static int System = -1;

   public static void main(String[] args) {

Compiling this gives me an error saying that "int cannot be dereferenced". The reason is obvious, but how should one handle situations like this. It is especially relevant in code-generation scenarios, where one cannot know what user code is intertwined with generated code.

In C# I would just use the "global::" namespace specifier before "java.lang", but what do you do in Java?


No general solution in Java. The way we live with this is to

  1. respect naming conventions, which distinguish class names from package/field names, and
  2. qualify static var with its class name when generating code.

Need Your Help

What pre-existing services exist for calculating distance between two addresses?

algorithm geolocation distance

I'd like to implement a way to display a list of stored addresses sorted by proximity to a given address.

Insertion into Hash Map data structure JAVA

java hashmap

I am using a program to read keywords in a file and sort them on basis of frequency. I am using Map data structure for the same.