Q1. How does 'java' find API classes installed in the system?
Q2. I experimentally made a class with default (package) access and put it into
a package. Then made another class with package access and with a main method
tried to run it.
The latter class also belonged to the same package as the previous one and it
used previous class to make one object. However, my attempt was unsuccesful.
What could be the fault?
Since main method is a public one should I make SecondOne class public too, or
is it that I can't run a class within the package itself?
Pl. help.
package myjava.java2;
class FirstOne {
int a=10;
int b=5;
int intMultiply() {
return a*b;
}
}
package myjava.java2;
class SecondOne {
public static void main(String[] args) {
FirstOne fo=new FirstOne();
System.out.println(fo.intMultiply());
}