public class Bar extends Foo { // 1 public static void main(String[] args) { // 2 System.out.print(sum(1, 2)); // 3 } } class Foo { int sum(int x, int y) { return x + y; } }
Login in to like
Login in to comment
So you can init a main method in an extended class?
2023 Feb 16, 3:10:52 AM
or Read more about Java Quizzes
Login in to like
Login in to comment