[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Undefined array key 22
[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Trying to access array offset on value of type null
Answer Happy • 1) What is wrong in the following code? (Note that the compareTo method for the Integer and Double classes was introduce
Page 1 of 1

1) What is wrong in the following code? (Note that the compareTo method for the Integer and Double classes was introduce

Posted: Sun Jul 10, 2022 11:29 am
by answerhappygod
1) What is wrong in the following code? (Note that the compareTomethod for the Integer and Double classes was introduced inprevious chapters)public class Test {public static void main(String[] args) {Number x = new Integer(3);System.out.println(x.intValue());System.out.println(x.compareTo(new Integer(4)));
}}
1 What Is Wrong In The Following Code Note That The Compareto Method For The Integer And Double Classes Was Introduce 1
1 What Is Wrong In The Following Code Note That The Compareto Method For The Integer And Double Classes Was Introduce 1 (26.46 KiB) Viewed 85 times
3) Show the error in the following code:interface A {void m1();}class B implements A {void m1() {System.out.println("m1");}}4) What is wrong in the following code?public class Test {public static void main(String[] args) {Person[] persons = {new Person(3), new Person(4), newPerson(1)};java.util.Arrays.sort(persons);}}class Person {private int id;Person(int id) {this.id = id;}}5) Show the output of the following code?Rational r1 = new Rational(-2, 6);System.out.println(r1.getNumerator());System.out.println(r1.getDenominator());System.out.println(r1.intValue());System.out.println(r1.doubleValue());
) - Which of the following is a correct interface? interface A { void print() { }; (a) abstract interface A { print (); } (c) abstract interface A extends 11, 12 [ abstract void print() { }; interface A { void print(); (b) (d)