Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9085851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:20:46+00:00 2026-06-16T21:20:46+00:00

Possible Duplicate: Why are these variables of an interface type not being used to

  • 0

Possible Duplicate:
Why are these variables of an interface type not being used to instantiate new objects?

In the code sample below from an API that I’m using, there is an initialization of the variables, “audiodecoder” and “cc”. The two variables are of an interface type. However, the keyword implements is not used anywhere in the code sample for any thing but actionlisteners.

This goes against anything I’ve learned about Java so far. I’ve listed the import statements below in the thinking that maybe they hold some clue about why IDecoder and ICodecContextWrapper do not have corresponding implements statements. I’ve also tried to find some documentation on using interfaces in this manner with no success. Could someone explain to me why the keyword implements is not used? Is there a name for this concept and, perhaps some documentation that you know of in regards to the concept?

edit: I should also add that the variables are not declared in the sample code with the keyword new either.

import org.libav.audio.Frame2AudioFrameAdapter;
import org.libav.audio.PlaybackMixer;
import org.libav.audio.SampleInputStream;
import org.libav.avcodec.ICodecContextWrapper;
import org.libav.avformat.IChapterWrapper;
import org.libav.avformat.IFormatContextWrapper;
import org.libav.avformat.IStreamWrapper;
import org.libav.avresample.bridge.AVResampleLibrary;
import org.libav.avutil.IDictionaryWrapper;
import org.libav.avutil.bridge.AVChannelLayout;
import org.libav.avutil.bridge.AVSampleFormat;
import org.libav.bridge.LibraryManager;
import org.libav.data.IFrameConsumer;
import org.libav.util.swing.VideoPane;


IDecoder audioDecoder = player.getAudioStreamDecoder(streamIndex);
ICodecContextWrapper cc = audioDecoder.getCodecContext();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:20:47+00:00Added an answer on June 16, 2026 at 9:20 pm

    This

    IDecoder audioDecoder = player.getAudioStreamDecoder(streamIndex);
    

    means that whatever is returned implements IDecoder.

    e.g.

    public IDecoder getAudioStreamDecoder() {
       // constructs...
       return new IDecoderImplementation(); 
    }
    

    Note the distinction in types between what’s constructed, and the returned reference.

    The object returned will be a concrete class, but since it implements that interface, it can be referred to by that interface. It could implement other interfaces too, and could have functionality exposed, but you’ll only be able to access it as a IDecoder

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: does these code has memory leakage?? static private ArrayList seriesColors = new
Possible Duplicate: Declaring variables inside or outside of a loop Please consider these 2
Possible Duplicate: Properties and Instance Variables in Objective-C 2.0 I'm confused by these two
Possible Duplicate: iPhone Interface Builder and Delegates What is the relationship between these three
Possible Duplicate: jquery-min version? These two files are already included while creating a new
Possible Duplicate: Android findViewbyId with a variant string I have this type of code
Possible Duplicate: C# 'var' keyword versus explicitly defined variables EDIT: For those who are
Possible Duplicate: Passing only two variables between controller and view - best practice? There
Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i ,
Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.