Why an Interface is used in a Java Program

Since we have Classes in Java program
Then what is the need for An Interface in a Java Program
Please explain to me
i'm confused

These are fair comments as per as interface is concern.... we need interface to declare the methods without implementing the methods. Basically interfaces help implementing classes in a organised way.
Now We got abstract class also, which has got more or less same features like interfaces. In abstract class also we can declare a method without implementation.
If we use abstract class and extend that abstract class, we don't have implement all the abstract methods in that particular class,which would extend the abstract class, but if we implement an interface in a class, we have to define all the methods with their body. Now, can anyone tell me , in a generic way, when do we use interface and when do we use abstract class. I don't need the differences between abstract class and interface...that i know...thanks in advance
take it easy
RD
l

Similar Messages

  • Why using JDeveloper runing java program is faster

    I have written a java program by JDeveloper 3.0, press run button to run the java check
    the performance.
    and then close JDeveloper, try to run the java program only on NT workstation.
    I found that the performance is lower than
    running inside JDeveloper.
    Why the reason ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rob (JDeveloper Team):
    If you are running under JDK 1.2, then the reason is that internally JDeveloper uses the OJVM (Oracle Java VM) which is faster than most other JVM's on NT. You may wish to try your app with the JDK 1.3 rc2 from the Javasoft website (which uses HotSpot) and will be faster than the stock JDK 1.2.
    <HR></BLOCKQUOTE>
    Is compatiable using SQLJ for HotSpot ?
    and if not using HotSpot
    Can I uses OJVM only to run my program ?
    How to do ?
    Thank you
    null

  • What do you use to write Java programs?

    Hi. Do you mind if I ask you what do you use to write your programs in Java? I am a student and we are using NetBeans IDE 3.6. I know it is a bit old but the tutor says we must stick to that one. What is best for writing Java programs?
    Thanks.

    Do you think those things will make things easier or is it more complex?If you're learning on your own, you'd better use something more up to date (most probably better interface, childhood bugs fixed, and better support on the Internet).
    If you're in a classroom, or a training room, you'd better use what the instructor tells, or at least what other students/trainees use. Easier to get help and share tips if everyone has the same setup.
    Good luck learning Java.

  • How to use wsimport in java program

    Hi friends,
    wsimport is an external tool that parses wsdl and generates java artifacts.
    Is there any way to use, invoke wsimport in a java program to parse wsdl and generate java artifacts ?
    Is there any wsimport API that gives same parsing functionality as wsimport tool, so that I can use it in my java program? I searched but I didn't get that's why I need to post here
    Thanks
    Harshit

    You may be able to call WsImport's main() method from your code, something like this:
    import com.sun.tools.ws.WsImport;
    String[] args = {"put", "your", "arguments", "here"};
    WsImport.main(args);(Make sure that the webservices-tools.jar file is on the classpath, since that's the one containing the WsImport.class file - you'll probably need the other webservices jars too).

  • Using Scanner within Java Program

    How do i call a scanner (scan documents) from a java application and collect the output from scanner in java application.

    Hi,
    You can try a package named: JTwain, which is available at http://asprise.com/product/jtwain.
    JTwain supports all kinds of digital cameras and scanners. You can use Java to access, contorl digital cameras and scanners, and of course, to acquire images with flexible settings.
    The developers' guide is available @ http://asprise.com/product/jtwain/devGuide.php
    In the simplest case, one line of Java code can solve your problem.
    Good luck!

  • Using Numbers with JAVA Programming

    I'm about to fail JAVA and require expert solution to this problem:
    When you take the year of the birth of Bill Clinton and add to it the year he took office plus his age at his last birthday, and then subtract the number of full years he has been in office, you get the number 3986 (or 3985 depending on the time of year in which you calculate). But when you add and subtract the similar figures for the leaders of Britain, and France, you get 3986 (or 3985) in each case! How can I solve this problem! Please help!

    I'm about to fail JAVA and require expert solution to
    this problem:
    When you take the year of the birth of Bill Clinton
    and add to it the year he took office plus his age at
    his last birthday, and then subtract the number of
    full years he has been in office, you get the number
    3986 (or 3985 depending on the time of year in which
    you calculate). But when you add and subtract the
    similar figures for the leaders of Britain, and
    France, you get 3986 (or 3985) in each case! How can
    I solve this problem! Please help!
    hehehe...you are a silly person...

  • Creating sales order using web dynpro JAVA

    Hello everyone,
    i am new to web dynpro. Can any one tell me how to creating sales order by web dynpro JAVA using BAPI.
    Thanks.
    Vinita Sharma

    Hi...
    you can use Adaptive RFC methodology in web dynpro java to work with BAPIs..... these are standard bapi's provided
    Here are required Bapis... select which one you want....
    BAPISDORDER_GETDETAILEDLIST Sales Order: List of All Order Data
    BAPI_ORDER_CHANGE_STATUS_GET Change status for order
    BAPI_SALESDOCU_CREATEFROMDATA Creating a Sales Document
    BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
    BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales Order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create sales order, no more maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all orders for customer
    BAPI_SALESORDER_GETSTATUS Sales order: Display status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    check this thread SALES ORDER creation using BAPI
    sample java program which will call SAP bapi function sales order create
    PradeeP

  • Using RAW in Jave Bean to store data in Oracle 8i database

    I have a question about using RAW in java program to read write data in Oracle database. Is there any sample with key information for me to refer to? Your help will be appreciated.
    Jane

    I have a question about using RAW in java program to read write data in Oracle database. Is there any sample with key information for me to refer to? Your help will be appreciated.
    Jane Jane,
    here is a code snippet provided by our QA team
    hope it helps
    Kuassi
    1. Create the table:
    "CREATE TABLE rawtable (key VARCHAR2(30), rawcol RAW(2000), longrawcol
    LONG RAW, moredata VARCHAR2(100))"
    2. Write the data:
    byte x[] = {1,2,3,4,5};
    byte y[]= {6,7,8,9,10};
    PreparedStatement pstmtR =
    conn.prepareStatement("INSERT INTO rawtable (key, rawcol,
    longrawcol, moredata) VALUES (?, ?)");
    pstmtR.setString(1, "rawcol data");
    pstmtR.setBytes(2, x);
    pstmtR.setNull(3, Types.LONGVARBINARY);
    pstmtR.setString(4, "Here's some more data!");
    pstmtR.execute();
    pstmtR.setString(1, "longrawcol data");
    pstmtR.setNull(2, Types.BINARY);
    pstmtR.setBytes(3, y);
    pstmtR.setString(4, "Here's some more data!");
    pstmtR.execute();
    pstmtR.setRAW(1, RAW_obj) can be used to insert the RAW data.
    You can also use setBinaryStream to insert RAW data:
    CallableStatement cstmt =
    conn.prepareCall ("begin insert into rawtab values (?,?); end;");
    cstmt.setBinaryStream (1, (java.io.InputStream) new
    ByteArrayInputStream(rawbuf), rawbuf.length);
    cstmt.setBinaryStream (2, (java.io.InputStream) new
    ByteArrayInputStream(lrawbuf), lrawbuf.length);
    3. Read the data:
    InputStream is = null;
    byte rawbuf [];
    byte lrawbuf [];
    ResultSet rset = stmt.executeQuery("SELECT rawcol, longrawcol FROM
    rawtable");
    // You can retrieve the data with the following methods
    rawbuf = rset.getBytes(1);
    lrawbuf = rset.getBytes(2);
    RAW raw1 = rset.getRAW(1);
    is = rset.getBinaryStream(column);
    is = rset.getAsciiStream(column);
    is = rset.getUnicodeStream(column);
    When using CallableStatement:
    ((OracleCallableStatement)cstmt).registerOutParameter(1,
    OracleTypes.RAW);

  • Using WD APIs in Java Programming

    Hi,
         First let me explain my scenario:
              I have to get the <b>attachments in a PDF document</b>, using a <b>java program</b>. I am using Java perspective of NWDS. I am using the APIs
    ->IWDPDFDocumentHandler
    ->IWDPDFDocumentAccessibleContext
    ->IWDPDFDocument
    ->IWDPDFDocumentAttachment
    in my program.
    When I run my java program, I am getting the <b>java.lang.NoClassDefFoundError</b>.  Can you please, give me a solution for this problem?
    Note :  I have added the necessary JAR files to the project.
    Thanks,
    Prabhakar.

    Hi Sumit,
       Here is the result which I got in the console,
    java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/services/exceptions/WDRuntimeException
         at PDFAttachment.readAttachmentFromPDF(PDFAttachment.java:241)
         at PDFAttachmentMain.main(PDFAttachmentMain.java:21)
    Exception in thread "main"
    Note :
    PDFAttachment
    - Class
    readAttachmentFromPDF
    - method
    The code is,
    String PDFDocName = "podetailswithAttachment.pdf";
                        //wdComponentAPI.getMessageManager().reportSuccess("Outside try FileName :"+PDFDocName );
                        try
                             //wdComponentAPI.getMessageManager().reportSuccess("Inside try FileName :"+PDFDocName );
                             FileInputStream fileInpStrm = new FileInputStream("C:\"+PDFDocName);
                             FileOutputStream fileOutStrm;// = new FileOutputStream()
                             ByteArrayOutputStream bo = new ByteArrayOutputStream();
                             int c;
                             while ((c = fileInpStrm.read()) > -1)
                                  bo.write(c);
                             byte[] pdfSource = bo.toByteArray();
    // Line :240     
                             IWDPDFDocumentHandler pdfdocHandler =WDPDFDocumentFactory.getDocumentHandler();
                             IWDPDFDocumentAccessibleContext pdfdocaccContext = pdfdocHandler.getDocumentAccessibleContext();
                             pdfdocaccContext.setPDF(bo);
                             IWDPDFDocument pdfDocument = pdfdocaccContext.execute();
                             IWDPDFDocumentAttachment[] pdfatt =   pdfDocument.getAllAttachments();
                             //wdComponentAPI.getMessageManager().reportSuccess("Length of the attachments: "+pdfatt.length);
                             //pdfdocaccContext.setPDF();
                        catch(Exception e)
                             //wdComponentAPI.getMessageManager().reportSuccess(""+e);
                             System.out.println(""+e);
    Thanks,
    Prabhakar.

  • How Can One use XML data into our Java Program

    I have an Java Program and an XML file contaning data. I want to parse the xml data and use into my Java Program. How can I do so.

    Check out the org.xml.sax.XMLReader class.

  • Using ASCII in java

    How can i use ascii in java programming. For example i want convert binary to decimal and use operator such XOR etc to campare to another decimal number. After that convert into ascii code.
    thank you

    If you have a string, then you can convert it into an array of char. Chars are just numbers. (They're numbers that represent unicode characters, but they're still numbers.)
    And all the primitive types in java are essentially binary; you don't have to convert anything to binary unless you mean to convert it for display purposes.
    If you have a string and want to convert it to ascii, then you can specify the encoding type (ascii) while converting to bytes or writing output to a file, etc.
    Hope this helps.

  • Updating ROWID in java program

    Hi Folks,
    I am updating a row in using ROWID in java program, it is not updating the records based on the rowid.. I am copying the sample code
              try{
                   for(i = 0; i < size ; i++) {
                        stmt.clearParameters();
                   oracle.sql.ROWID rowIds = (oracle.sql.ROWID)list.get(i);                    
                        stmt.setString(1,status);
                        stmt.setString(2,idArray[i]);
                        stmt.setString(3,message[i]);
                        stmt.setROWID(4,rowIds);                    
                        stmt.executeUpdate();                    
                        //stmt.addBatch();
    Java Method to update the SQL
    private String getUpdateSqlString(){
              StringBuffer sql = new StringBuffer(20);
              sql.append(" update xx_custom_table set status_flag = ? , ");
              sql.append(" id= ?, status_message = ? where rowid = ? ");
              sql.append(" status_flag = 'U' ");
              return sql.toString();
    Can any one explain this ?
    Thanks
    Kranthi

    kumar_d wrote:
    I checked the list, valid rowid is populated in the list. Can you explain how you determined that and what, exactly, you mean by "valid rowid"?
    You are stating that every element in LIST is
    - A ROWID in a valid format
    - That corresponds to a row in XX_PRODUCT_TABLE
    - Where STATUS_FLAG = 'U' already?
    The only way to get that information is to query the XX_PRODUCT_TABLE table, so presumably you are doing that before this snippet of code runs. Any chance that the row is modified or deleted by some other session between the time you query the database to get the ROWID and the time you run the update?
    And more generally, why are you using the ROWID here? It seems odd that you would be identifying the rows to update, storing the set of rows to update in a Java collection, and then iterating over that collection to do the actual updates. A simple set-based UPDATE, or at least a stored procedure, would seem far more efficient...
    Justin

  • Java Programming Language Answers

    Hi,
    My business is to teach Java to legacy engineers. I'd like to use a book "Java Programming Language" as one of materials. This book contains number of excellent excercises,but without answers. I found a Web page of answers which is http://java.sun.com/docs/books/javaprog/firstedition/answers/, but this page covers Chapter 1 to 14 and appendix. This book has Chapter 1 through 20. I would gratefully appreciate if someone tell me where answers for Chatpter 15 to Chapterr20.
    Thanks and Regards,
    Shintaro Sekine
    [email protected]

    It should be no problem if you give them your own answers.
    When you couldn't give right answers for a few of them, Mr. jverd et al would
    help you on this forum.

  • Getting java program to run (really basic)

    Hi,
    I'm used to running java programs through the programs I write with, like Eclipse, but now I'm trying to run a program on a compuyer without those things and I'm stuck.
    I'm running Windows XP and have downloaded the SDK Version 1.4.2, The java.com website says I have the latest software, everything is up to date.
    All the sites I see say that the way to run a program is to use the 'javac' command from the command prompt. However, doing this (with or without a file name appended) gives me the error: 'javac is not recognized as an internal or external command, operatable program or batch file.'
    What do I need to do to run a simple java program from a bunch of .java files?
    Help much appreciated, thanks.

    All which instuructions?
    1. I've followed all the instructions at 'Installation Instructions', http://www.java.com/en/download/help/5000010300.xml. They have instructions to
    .A: Download and Install: All done.
    .B: Enable and Configure: They say it only relates to browsers and applets
    .C: Test installation: Test comes out positive.
    2. The files that were downloaded: Contain no instructions
    3. All the 'Enable' instructions found here: http://www.java.com/en/download/help/index_configuration.xml
    These relate to:
    .A:Switching between Microsoft VM and JRE
    .B:Enabling JRE for browsers and Applets
    .C: Clearing the cache
    .D: Viewing the console,
    etc etc. None of them seem to be about setting a path.
    Can you tell me which instructions you mean?
    Thanks

  • Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Hi Elizabeth,
    Do your Mac meet any of these requirements?
    http://www.wvnet.edu/services/webct/requirements.html
    From this it appears to be PC only!???
    http://sourceforge.net/projects/awebctcclient/files/Pancake%20%28it%20own%20proj ect%20now%29/Pancake%20Console%20V1.0.0/PancakeConsole-1.0.0-src.zip/download
    Can you provide any more info on which bersion or file you have?
    Can you tell us why you need this for your use?

Maybe you are looking for

  • Problems with iTunes 10.6.1 - rendering stops while playing music

    Hi everybody, I am writing because some problems with iTunes, that appeared currently. Never had this problems before... When playing music suddenly the rendering stops for several seconds and then it continues without any action from my side. Maybe

  • Message no.FMCF101 and FI228

    Dear All, We have created PO in the FY-2014 and GRN is also taken in the year 2014.While doing MIRO during the FY-2015 we are getting the below error. Automatic Carryforward is only allowed for amount 0 Message No. FMCF101 and document item has not 

  • Dates on photos that are downloaded....

    I have a strange one with this new Iphoto 08. It changed the date on a batch of photos to 2016. I cannot change it as I did with the other Iphotos and I want to be able to organize my downloads from to have the most recent at the top of the library.

  • Problem with storer

    Hello, I have ZfD3sp1, NW6sp2. Invetory and DB were reinstaled and DB was restored from backup. Whole ZEN and Inventory works fine, wkst with record in DB are updated, but new imported wkst no. I have find only one error : [8/4/03 09:56:15.737] ZENIn

  • How do i create an account and start using it

    If I have a user name which is different from my e-mail name, do I set up a new account to start using the ipod touch