Embarking on your Java learning journey, you might find the need to test your code snippets immediately without setting up a local development environment. Here's where Java online compilers come into play, offering a quick, convenient, and interactive coding experience. But what about including external libraries or importing classes? Let's dive into using a Java online compiler with import.

We'll explore two popular Java online compilers - Repl.it and OnlineGDB - focusing on their 'import' feature. Understanding how to use this functionality opens the door to more complex projects that rely on external libraries.

Using Import in Repl.it
Repl.it is a cloud-based IDE supporting over 50 programming languages, including Java. Let's see how to import classes using Repl.it.

1. **Setting up the Repl.it Java project**: Click on the 'New Repl' drop-down, select 'Java', and name your project. You'll see a Java run-time environment ready for use.
Importing the Java Util Library

To import the Java.util library, type 'import java.util.*;' at the beginning of your code. This allows you to use classes like Scanner, ArrayList, etc.
Example:
```java import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); // Your code here } } ```
Importing Other Libraries

To import other libraries, use the full package name. For instance, to import the ΠΊΠ°ΡΡΠΎΡ library, type 'import com.google.common.collect.ImmutableList;' at the beginning of your code.
Example:
```java
import com.google.common.collect.ImmutableList;
public class Main {
public static void main(String[] args) {
ImmutableListUsing Import in OnlineGDB

OnlineGDB provides a quick and simple Java coding environment. Let's import classes using this online compiler.
1. **Setting up the OnlineGDB Java project**: Click on 'Java' from the supported languages list and you're ready to go.



















Importing the Java Util Library
Similar to Repl.it, type 'import java.util.*;' to import the Java.util library. OnlineGDB recognizes this syntax and allows you to use classes from this library.
Example:
```java import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); // Your code here } } ```
Importing Other Libraries
Like Repl.it, use the full package name to import other libraries in OnlineGDB. For instance, to import the kajtor library, type 'import com.google.common.collect.ImmutableList;' at the beginning of your code.
Example:
```java
import com.google.common.collect.ImmutableList;
public class Main {
public static void main(String[] args) {
ImmutableList Online Java compilers with import functionality help you explore and practice coding in an interactive and efficient environment. Happy coding!