package pkg;
// learn about Random
import java.util.*;
public class p42 {
public static void main(String[] args) {
Random ran=new Random(914);
System.out.println("ran="+ran);
int i=ran.nextInt(20);
int j=ran.nextInt(100);
int k=ran.nextInt(100000);
System.out.println("i="+i);
System.out.println("j="+j);
System.out.println("k="+k);
}
}
//----------------------------------------
package pkg2;
public class p42 {
public static void main() {
System.out.println("this is another p42 class but in pkg2");
}
}
//----------------------------------------
package pkg3;
import pkg.*;
import pkg2.*;
public class test {
public static void main(String[] args) {
p42 obj=new p42(); // ambiguous ERROR
}
}
output:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type p42 is ambiguous
The type p42 is ambiguous
at pkg3.test.main(test.java:10)