• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Java Certification

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one explain this code, from Sun Certified Programmer & Developer for Java 2 Study Guide


*****************************Would like to understand the purpose of this three line-code
 
Bartender
Posts: 2236
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Please UseCodeTags (this is a link) when posting.

This line declares a variable sc of type Child, creates a new instance of Child and assigns a reference to this instance to sc.
This line calls a method testIt() on the object referenced by sc
This line is a declaration of the method testIt(). The method is public, has no return type and takes no arguments.
Aren't those topics explained in the study guide?
 
Marshal
Posts: 76795
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again

Is that exactly how the code was formatted in the examples? They like confusing indentation in exam revision sites. You do not have three lines of code there. You have two lines in the main() method and the header of the following method. You need ot be very careful with such exam sites to check the indentation and match the {}.
 
What's gotten into you? Could it be this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic