Can I take Java interface as .h of C?

Can I use Java interface as a substitute of .h files in C?

It almost sounds as if you want to use C, not an OOP language like Java. So why not use C?

Similar Messages

  • Contract-first : WSDL vs Java interface

    Hello,
    I am starting to work with web Service.
    Many blogs and articles suggest to write WebServices contract from a WSDL.
    I am a java Programmer. I totally agree with the contract-first and the data-driven communication concept.
    Here is my question: why use WSDL when you can convert any Java Interface and Bean into a WebServices?
    If a tool gives you the possibility to move from xml to java (and vice-versa), why not stay with a java interface?
    What are the pitfalls of using this technique (other than being too easy to change the contract)?

    The main reason why you would want to write WSDL first is to be able to create a more verbose XML schema. For instance, if you take a raw Java interface or class and convert from Java to WSDL/XSD everything ends up being optional because the converters have no idea what is supposed to be required versus what isn't as well as field length restrictions etc. Some of the newer tools may allow you to do this with annotations but I haven't really looked into this.
    Writing the XML schema first allows you to offload more work on the XML parser at run time because it can do the schema validation for you instead of you having to manually perform this. This also allows someone writing their own client to consume the WSDL and be able to generate a client that will do more work than one based off of Java classes (e.g. someone creating a .NET client can let the XML parser do some heavy lifting during the marshalling process before ever sending the request to your web service).

  • Java interfaces allow us to specify limited ways in which otherwise

    can anyone explain "Java interfaces allow us to specify limited ways in which otherwise dissimilar classes, from completely different parts of inheritance hierarchy, resemble one another." please?
    many thanks.

    An interface defines a contract which an implementing class must fulfill. As long as the implementing class is written properly, then it provides a specific, advertised behavior. There are no restrictions as to which classes may implement a given interface (in the sense that there are inheritance restrictions, such as single-inheritance, no inheritance loops, and the like). Therefore, any two arbitrary classes may implement the same interface, and therefore provide the same behavior.
    For example, the Iterator interface provides the ability to loop over a collection of objects in a well-defined way. Any class which implements Iterator would be manipulable in the same way, and could therefore be said to resemble each other.

  • How Can I Take Print Screen With in java Application

    Hello Every One,
    Hope U all r fine.
    How can i take print screen with in java code,
    Please Help me out

    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2Btitle%3A%22print+screen%22&col=javaforums

  • Can I call an interface from java

    Dear All,
    Can I call an interface from java in ODI ?
    Best Regards
    Arc

    Short answer, Yes.
    Long answer - you must create a scenario from the interface (the scenario is the "executable" code), right-mouse-button on the interface in the tree and "Generate Scenario". This can then be called using the invocation api this is documented in your <installationdirectry>/oracledi/doc/sdk/invocation. This points you at all the necessary classes etc to use.

  • Java interface

    Hello all,
    I want to create a simple interface that can receive simple xml files(not wsdl) through an http connection in order to handle its data. I can't use Soap and Jax-rpc because the sender is n't using this technologies.He just sends an xml file to me. Can anyone give some details of how can i do this ?
    Thank you

    Sure take a look at JAX-WS. You can use the Provider interface. There is a sample showing how this is done. http://jax-ws.dev.java.net.

  • Can i take live video from TV tuner? how? urgent help is needed

    can i take live video from TV tuner? how?
    i have downloaded this code for a web cam how can i adjust it to take live video from TV tuner
    * WebcamPlayer.java
    * Created on November 22, 2004, 4:09 PM
    import javax.media.Player;
    import javax.media.CaptureDeviceInfo;
    import javax.media.MediaLocator;
    import javax.media.CaptureDeviceManager;
    import javax.media.Manager;
    import javax.media.format.VideoFormat;
    import java.awt.Component;
    import java.applet.*;
    import java.util.Vector;
    * @author Administrator
    public class WebcamPlayer extends Applet
    private CaptureDeviceInfo device; // Contains the device properties
    private MediaLocator ml; // Contains the location of the media comming from the webcam
    private Player player; // the player
    private Component videoScreen; // Component that is capable to show the player's visual component
    public void init()
    try
    {   //gets a list of devices how support the given videoformat
    Vector deviceList = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.MJPG) );
    //device = CaptureDeviceManager.getDevice("vfw:Creative WebCam NX Pro (VFW):0");
    //gets the first device from the deviceList
    device = (CaptureDeviceInfo) deviceList.firstElement();
    System.out.println("Chosen device: "+device.getName());
    //String str1 = "vfw:Creative WebCam NX Pro (VFW):0";
    // de webcam indentifiseren
    //device = CaptureDeviceManager.getDevice(str1);
    //gets the location of the device, is needed for player
    ml = device.getLocator();
    // makes player and gives the streaming video location (that is locate in the MediaLocator)
    // this oparation is blocking until Manager has made a player that is realized.
    player = Manager.createRealizedPlayer(ml);
    //starts the play
    player.start();
    //Gets a component from the player that can show the actual streaming from the
    //webcam.
    videoScreen = player.getVisualComponent();
    //adds the component that displays the streaming to the applet.
    add(videoScreen);
    // Now the user can see the steam that is from the webcam in the applet
    catch(Exception e)
    System.out.println("no device");
    thanks here is my mail if any wants to mail me [email protected]

    just visit
    http://javasolution.blogspot.com/2007/04/java-tv-api-overview.html

  • HT1338 Help I can't get Java to down load to my Mac version 3.06 I have did the soft ware up date ?

    Help I can't get Java to down load !

    Hello BROitsJAMIE,
    Thanks for using Apple Support Communities.
    I'd like you to please follow the troubleshooting in the article linked to below in order to resolve this issue with your Mail.
    OS X Mail: Troubleshooting sending and receiving email messages
    Take care,
    Alex H.

  • Hey guys ! I use logic pro ... not logic proX ... and i want to record my drums with 4 mics. I got a mixer with also 4 inputs ( Behringer Xenyx QX 1202USB ) But in my Logic i can't take the third input !?!? i can only choose 1 and 2 .... Please Help :)

    hey guys ! I use logic pro ... not logic proX ... and i want to record my drums with 4 mics. I got a mixer with also 4 inputs ( Behringer Xenyx QX 1202USB ) But in my Logic i can't take the third input !?!? i can only choose 1 and 2 .... Please Help

    Friedrich sp wrote:
    Can you send me a mixer wich can do that, please ?
    Who do you think I am? Santa Claus?
    What you need is not a mixer, but an audio interface with at least 4 mic inputs. There is a lot of choice there, but you should indicate a budget. You can go from, say, € 300 to € thousands, if you want.
    Roland UA 1010
    Focusrite Scarlett 18i8
    However, there are other options (like multi-out mixer plus multi in interface, or standalone mic preamps plus interface with 4 inputs, etc). I have little experience using these however so I really cannot say much about which one(s) to get. The two mentioned above both have four mic preamps, but they are by no means the only way to do it.
    The cheapest solution I can think of is to get a second 1204USB, plug it in, and in OS X create an Aggregate device (=the two are being merged into 'one virtual' interface with two discrete stereo (= four discrete mono) inputs. Disadvantage: you keep the same (limited) soundquality of the 16 bits convertors. Getting any of the interfaces mentioned earlier will also mean you'll make the significant step up from 16 to 24 bits sound.

  • Java Interface Question.

    There are classes in the Java SDK, such as the Interface:
    org.w3c.dom.Document
    that have factory methods in them that carry out actual operations.
    But how can this be possible, because when I program an interface:
    public interface test {
    public void setString(String s);
    It will only compile thus, with no implementation on the method signatures?
    How do Java interfaces with factory methods to this?
    org.w3c.dom.Node is another one. Where does the functionality/method implementation
    come from?

    public interface MyInterface {
         public void method1();
    class MyImplementation implements MyInterface {
         public void method1(){
    public class MyFactory {
         public static MyInterface createMyInterface(){
              return new MyImplementation();
    public class Test{
               public static void main(String args[]){
                      MyInterface x=MyFactory.createMyInterface();
                      x..method1();
    }Now can you understand this? Assume all These classes are separate classes. This is not a problem with inner classes. Before make a reply, try to understand it or post a reply as saying it is not clear rather than posting this kind of post.

  • Are Java Interfaces 'free'?

    From a performance point of view, are Java interfaces free?
    That is, if I have:
    class Foo
    public void bar() { ... // some code }
    }and I change it to:
    interface Foo
    public void bar();
    class FooImpl implements Foo
    public void bar() { ... // some code }
    }And I call one or other of the Foos like
    Foo foo // A parameter, field or local variable.
    foo.bar();Does calling foo through an interface add any overhead that calling it direct in the first example not? As I understand it, all methods are 'virtual' in Java, so it should perform the same in either case.
    Thanks for any of your thoughts.
    Rupert

    rupertlssmith wrote:
    YoungWinston wrote:
    The Second Rule of Program Optimization (for experts only!): Don't do it yet.&#148;
    - Michael A. Jackson
    Basically, don't worry about it. Worry about writing clear, correct, object-oriented code.
    Wierdly enough, in the long run, that is more likely to help than anything else you can do, should (and if) you ever need to worry about optimization in the future.
    WinstonThanks for the advice. I can write good clear OO code. I am now at the future and worrying about optimization, so have made it past the second rule!Then you exactly know where your bottleneck is from the profiler you've used. Did it tell you that your interfaces are the bottleneck? If so, why do you even bother to ask here?

  • Java interface with Crystal Reports

    Post Author: [email protected]
    CA Forum: JAVA
    Hello everyone,I need to build a Java interface for JSP to interact with crystal reports.Could anyone recommend any book or forward me the url's where I can find the related material with examples. Eagerly Waiting for reply!Thanks,Prathima.

    Post Author: MJ@BOBJ
    CA Forum: JAVA
    The latest version of the Java Report Component (JRC) is available from the Diamond website.  This download is actually a plugin for Eclipse but you can still use the JRC runtime jars to use the SDK APIs in your JSP page.  You will also find lots of resources such as samples, videos, and forums to help you get started.  You can also refer to the DevLibrary for more information.

  • Some web pages need Java Platform to open-Can I download Java for I Phone?

    Cant opend some pages that needs Java to start.
    Where can I download Java Platform for I Phone 3D ?
    Thanks
    J.B

    Ok, It is my first time here on forum, so I posted by mistake the question
    several times SORRY !!!!!!! I tried to take it away but no.
    I have no intentions to "get extra responses".
    Banned ???? You must be joking !!!!
    I have bought a new Iphone 3D and cant open several pages with Java
    and I bring it up on ths forum, What is your problem ??

  • Can I change the interface of iOs 7 to recover the appearance of iOS 6 ?

    I upgrade my iPhone 4S with iOs 7 but  I don't like the new interface.
    Can I change the interface to recover the appearance of iOS 6?
    Thank's!

    This interface is horrendous and painful to the eyes.  We have to be able to change the look.  I mean even Windows let's you change.  So can Linux.  Yikes, this is really, really ugly.    Feel like I'm back in a VGA Windows world. What was all the hoopla about?  Can I take come of the Cupertino Cool Aid?
    APple, have mercy on those of us who adopted you for your deep, luscious feel. This is like going back to Windows.  It hurst the eyes, really.
    bummer!

  • Java interface as an Axis Web Service

    Hi averybody:
    I'm developping an application containning a web service using Axis 1.2 with Tomcat 5.5.7. I had design a Java interface for the WS and create mi deploy.wsdd file for it using Message-style.
    Everithing goes right in deployment process, but when i try too use de WS from a client, i get de following error:
    Exception in thread "main" AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.InstantiationException: chatService.IChatServer
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname: visit18 (este el nombre de esta m�quina)
    java.lang.InstantiationException: chatService.IChatServer (esto es lo que da problema)
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
    .java:260)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
    java:169)
    at org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseri
    alizationContextImpl.java:1015)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
    ser.java:585)
    at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespa
    ceBinder.java:898)
    at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBind
    er.java:644)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
    XMLDocumentFragmentScannerImpl.java:1008)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
    LDocumentFragmentScannerImpl.java:329)
    at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
    a:525)
    at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
    a:581)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
    ava:1175)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
    tionContextImpl.java:242)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at samples.message.TestChatMsg.doit(TestChatMsg.java:64)
    at samples.message.TestChatMsg.main(TestChatMsg.java:86)
    The code of my interface is this:
    public interface IChatServer {
    public void connect(SOAPEnvelope req, SOAPEnvelope resp);
    public void disconnect(SOAPEnvelope req, SOAPEnvelope resp);
    public void publishMessage(SOAPEnvelope req, SOAPEnvelope resp);
    public void retrieveMessages(SOAPEnvelope req, SOAPEnvelope resp);
    public void retrieveUsers(SOAPEnvelope req, SOAPEnvelope resp);
    Can anybody tell me what's happening here...
    Thanks.

    Hi, did you find out what the problem was ?
    I've got the same problem.
    Thanks,
    Lotte

Maybe you are looking for