This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Transfer Learning for Natural Language Processing (MEAP) and have Paul Azunre on-line!
See this thread for details.
Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Which of the lines fail to compile and why?

 
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Given:


Which of the lines will fail to compile?


I don't understand this one. Can someone explain with another example. thank you again for helping
 
Sheriff
Posts: 7602
521
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you use any book as a resource? What's written there there you don't understand about this topic?

I think would be quite difficult to use some other example not knowing more precisely what you actually don't understand.
 
Niall Kev
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I have read the Jeanne Boyarsky book. Maybe points aren't sinking in. From the above after reading the answer, I see you can't call static methods with Classname.static method?
 
Liutauras Vilda
Sheriff
Posts: 7602
521
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Niall Kev wrote:From the above after reading the answer, I see you can't call static methods with Classname.static method?


No. You can, but method needs to be static, which isn't the case in your specified snippet.
 
Niall Kev
Ranch Hand
Posts: 40
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so StaticTest.m1(); and StaticTest.m3(); fail because they are not calling static methods? simple as that?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
line no 3 and line no 7 fails to compile because they are non static and also remember if you remove the error lines you will still get StackOverflowerror because method calling itself...
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic