I have the following java class:
public class ExampleClass{
public static void main(String[] args){
Operation op1 = new Operation();
}
}
And then in another location I have this class:
public class Operation{
public int value;
}
Is it possible to create a new Operation object in ExampleClass WITHOUT directly importing Operation in ExampleClass. I want to compile de Operation.java, then copy the resulted Operation.class file to the location of ExampleClass and use this file to compile ExampleClass.java. Is such a thing possible ?
ExampleClassusing theOperation.class, just as you want, without any problems. There is no requirement to have the source code ofOperationavailable. That’s how you compile your code against the JDK classes, as well as 3rd party libraries, without the need to have their source code at hand.