import Java Keyword Example
package com.javaguides.teacher;
import com.javaguides.course.Course;
public class Teacher {
List<Course> courses = new ArrayList<>();
public void addCourse(Course course) {
courses.add(course);
}
}
- The fully qualified name of the class can be used. For example:
import com.javaguides.course.Course;
- The package can be imported using the import keyword and the wildcard (*). For example:
import com.javaguides.course.*;
import java.io.File;
import java.net.*;
Java static import
import static java.lang.Math.PI;
// class declaration and other members
public double area() {
return PI * radius * radius;
}
Continue Learning with Java Guides
Want to take your programming skills to the next level? Explore my practical Udemy courses on Java, Spring Boot, Microservices, Full-Stack Development, Docker, and Generative AI. You can also follow my structured learning roadmaps to become a professional developer.
By Ramesh Fadatare - Udemy Instructor Partner
Comments
Post a Comment
Leave Comment