Default values

  • 8
  • Locked
In this task, you need to create 7 public fields for a class. Be sure they are initialized with default values ​​(int intVar, double doubleVar, Double DoubleVar, boolean booleanVar, Object ObjectVar, Exception ExceptionVar, and String StringVar). In the main method, display their values in the specified order.
You can't complete this task, because you're not signed in.
Comments (8)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 16 , Slovakia
21 March, 18:54
A really great exercise :)
Jonaskinny Java Developer at Sandmedia
2 March, 21:25
'or separated by a space' don't believe it. StringBuilder().append(x.x).append(' ').toString() will not be accepted
Level 24 , Wittenberg, Germany
4 June 2021, 18:33
task1516 (Default values) hints: The requirements say "You don't need to initialize variables.". You can take that to the bank. Also, the requirements state things like "The Solution class must define an int field intVar.". This should be understood in the same sense as we usually understand it when someone says "FooBar has an integer field" (i.e. referring to instances by default and requiring extra qualification whenever that is not the case). Also, one should heed any requirements regarding accessibility modifiers, should there be any in the text.
Kent Hervey Software Engineer/Consult at Zeal IT Consultants
13 April 2021, 23:50
This task forces us to make variable names starting with an uppercase letter
Jonaskinny Java Developer at Sandmedia
2 March, 21:23
Don't get me started
Karas Java Developer
26 February 2021, 23:05
Yeah, but if you do not initialize them also throws an error, you make them static but also asks you not to be static.
Level 22 , Dublin, CA, United States
4 March 2020, 17:31
Instructions for this task is unclear. First it says, "Be sure they are initialized with default values". However, on requirement 8 it says "You don't need to initialize variables". It sounds very confusing. Please update the description/requirements to be more clear.
Level 41
6 March 2020, 09:18
You don't need to initialize variables because they will be initialized with default values automatically)