• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

what will happen if the program is like this

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public abstract interface ValueHolderInterface {

// Methods
Object getValue();
boolean isInstantiated();
void setValue(Object object);
}

what will happen if getvalue method is not present in Object class
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public abstract interface ValueHolderInterface

Note: You do not need to add the keyword "abstract" when you declare an interface. Just remove the word "abstract".

"what will happen if getvalue method is not present in Object class"

What do you mean exactly - do you mean: "what will happen if I create a class that implements interface ValueHolderInterface and I don't provide a getValue() method in that class?"

Why don't you just try it out and see what the compiler says? You learn most by experimenting and finding things out yourself.
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code is a part of a huge project... i cant compile it separatly.. so asked??
 
Marshal
Posts: 70318
283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you can compile it separately. You should be compiling and running your project at least once every 60 seconds while you develop it.
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well said Ritchie.
I guess that our friend is confused with the return type of getValue() method. If the return type of a method is a type, it is not necessary for it to be defined in that class.

Hope this is what you meant.

Sid.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by prasanna sheregar:
the code is a part of a huge project... i cant compile it separatly.. so asked??


You can just copy and paste the relevant code into a file and compile that. For example, copy and paste this into a file named Test.java and compile it:
 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys...... this forum is really good... you get reply soon . and people are very knowledgable
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic