Engineering Full Stack Apps with Java and JavaScript
Given the following class, which statements can be inserted at line 1 without causing the code to fail compilation?
public class TestClass{ int a; int b = 0; static int c; public void m(){ int d; int e = 0; // Line 1 } }
Select 4 options
A. a++; B. b++; C. c++; D. d++; E. e++;
A, B, C, E
All the instance or static variables are given a default values if they are not explicitly initialized. All numeric variable are given a value of zero or equivalent to zero (i.e. 0 for integral types and 0.0 for double/float). Booleans are initialized to false and objects are initialized to null.
Logged in users see lesser ads and get more features.
If you want to solve the questions together with the experts and understand the concepts better, please contact us using the contact form or WhatsApp numbers. Selected people get to do that without any additional charges.