Student.java:
package edu.manipal.mit;
class Student {
String name;
int rollNumber;
void displayDetails() {
System.out.println("Name: " + name);
System.out.println("Roll Number: " + rollNumber);
}
}DefaultAccessDemo.java:
package edu.manipal.mit;
public class DefaultAccessDemo {
public static void main(String[] args) {
Student student = new Student();
student.name = "Achu";
student.rollNumber = 12345;
student.displayDetails();
}
}AccessTest.java:
package edu.manipal.kmc;
import edu.manipal.mit.Student; // This will cause a compilation error
public class AccessTest {
public static void main(String[] args) {
Student student = new Student(); // Compilation error here
student.name = "SomeGuy"; // Compilation error
student.rollNumber = 67890; // Compilation error
student.displayDetails(); // Compilation error
}
}