Correct all mistakes in the code to run it. Don't declare or remove any declared classes or interfaces. Just correct access modifiers and mistakes in the permits clause.
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingClasses and objectsClasses and members
Sealed classes and interfaces
Correct mistakes in the code
Report a typo
Sample Input 1:
Congratulations, all tests passed succesfully!Sample Output 1:
Congratulations, all tests passed succesfully!Write a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println(scanner.nextLine());
}
}
sealed interface ShapeInterface
permits TriangleInterface { }
sealed class Shape
permits Triangle, Square, Circle { }
public non-sealed interface TriangleInterface extends ShapeInterface { }
final class Triangle extends Shape implements ShapeInterface { }
protected sealed class Square extends Shape { }
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.