lets say i have a file MainClass.class which i think contains the following code
public class MainClass {
public static void main(String[] args) {
App app = new App(5,17);
app.Answer();
}
}
based on the MainClass.class i wrote a simple class called App.java, witch add 2 numbers.
public class App {
private int num1;
private int num2;
private int sum;
public App(int n1, int n2){
num1=n1;
num2=n2;
}
public void Answer(){
sum=num1+num2;
System.out.println("The sum of "+num1+" and " +num2+" is : "+sum);
}
}
my question is how can i linked them and see if its compiles if i dont know whats inside the MainClass.class
i hope my question is clear
I’d recommend, as Edwin Dalorzo said, to try decompiling the .class. But for what you’re doing. You would:
That will do what you’re trying to say.