• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

interface

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hii
the other question here.

all interfaces are abstract, am i right?

then how can it be instantiated, n the code here is valid?

interface IFace{}


class CFace implements IFace{}

class Base{}

public class ObRef extends Base{

public static void main(String argv[]){

ObRef ob = new ObRef();

Base b = new Base();

Object o1 = new Object();

IFace o2 = new CFace();

}}


o1=o2

b=ob

o1=b
and if i insert these lines here all are valid how can ol=o2?

Edited by Corey McGlone: Fixed Misspelled Subject
[ May 28, 2004: Message edited by: Corey McGlone ]
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out this tutorial I wrote once upon a time. It probably has a lot more information than you need, but the answer to your question is there, as well. At the very least, I hope it's a useful read.
 
reply
    Bookmark Topic Watch Topic
  • New Topic