🎓 A1Learner
🔍
0 of 40 lessons completed

Java Intermediate Introduction

Java Intermediate goes one level below the concepts from the beginner course. It covers collections machinery, generics, lambdas and streams, exceptions with resources, and file work.

Scores filtered by hand

A beginner-style program filters passing scores with an explicit loop. It then sorts the short list and prints each score.

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
  public static void main(String[] args) {
    int[] scores = {92, 75, 88, 61, 95};
    List<Integer> passed = new ArrayList<>();
    for (int score : scores) {
      if (score >= 80) {
        passed.add(score);
      }
    }
    Collections.sort(passed);
    for (int score : passed) {
      System.out.println(score);
    }
  }
}

The same job as a pipeline

This stream pipeline is a framed preview of a later lesson. It filters, sorts, and prints the same scores in one chain.

import java.util.List;
public class Main {
  public static void main(String[] args) {
    List<Integer> scores = List.of(92, 75, 88, 61, 95);
    scores.stream()
      .filter(score -> score >= 80)
      .sorted()
      .forEach(System.out::println);
  }
}

Example

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
  public static void main(String[] args) {
    int[] scores = {92, 75, 88, 61, 95};
    List<Integer> passed = new ArrayList<>();
    for (int score : scores) {
      if (score >= 80) {
        passed.add(score);
      }
    }
    Collections.sort(passed);
    System.out.println(passed.size() + " scores passed");
    for (int score : passed) {
      System.out.println(score);
    }
  }
}

Key points

  • Collections come first, with lists, maps, and sets explored below the surface.
  • Generics explain how one class or method can work safely with many types.
  • Lambdas and streams then give shorter ways to process a collection.
  • Exceptions with resources and file work close the course.
  • Every lesson deepens a beginner concept and shows its machinery in print.

In this example, a loop keeps the scores of 80 or more, and Collections.sort orders the three survivors before they print.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What is the main idea of Java Intermediate?