public class WaterBottle { private String brand; private boolean empty; public static void main(String[] args) { WaterBottle wb = new WaterBottle(); System.out.print("Empty = " + wb.empty); System.out.print(", Brand = " + wb.brand); } }
❌ A. Line 6 generates a compiler error. ❌ B. Line 7 generates a compiler error. ❌ C. There is no output. ✅ D. Empty = false, Brand = null ❌ E. Empty = false, Brand = ❌ F. Empty = null, Brand = null
Explanation: Boolean fields initialize to false and references initialize to null, so empty is false and brand is null. Brand = null is output.
public class WaterBottle { private String brand; private boolean empty; public static void main(String[] args) { WaterBottle wb = new WaterBottle(); System.out.print("Empty = " + wb.empty); System.out.print(", Brand = " + wb.brand); } }
❌ A. Line 6 generates a compiler error. ❌ B. Line 7 generates a compiler error. ❌ C. There is no output. ✅ D. Empty = false, Brand = null ❌ E. Empty = false, Brand = ❌ F. Empty = null, Brand = null
Explanation: Boolean fields initialize to false and references initialize to null, so empty is false and brand is null. Brand = null is output.
BY Explanations “Top Java Quiz Questions”
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another option—secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secure—like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.
Telegram is riding high, adding tens of million of users this year. Now the bill is coming due.Telegram is one of the few significant social-media challengers to Facebook Inc., FB -1.90% on a trajectory toward one billion users active each month by the end of 2022, up from roughly 550 million today.