A question about class and interface? please help me!

the following is program:
interface A{
public class B implements A{
public static void main(String [] args){
A a = new B();
System.out.println(a.toString());
}i want to ask a question, the method toString() is not belong to interface A, why a can call method toString()? the interface call the method that isn't belong to, why? please help me...

because a.toString() call the method toString() of class Object because B implements A, but extends Object and in the class Object there is a method toString(). infact if you override the method toString() in class B, a.toString() call toString() in class B.
try this:
interface A {}
public class B implements A
  public String toString()
    return "B";
  public static void main(String [] args)
    A a = new B();
    System.out.println(a.toString());
  }by gino

Similar Messages

  • About Classes and Interfaces

    How can we define the classes and interfaces in an interview can u give me any realtime example for this

    How can we define the classes and interfaces in an
    interviewThe easiest explanation probably is to say that an interface in Java is a special class, namely a totally abstract one, that has been given a separate name.
    Classes and interfaces (because they're classes in disguise) both constitute types, meaning that variables can be declared of them. The difference is that a class can carry implementation whereas an interface cannot (because it's totally abstract).
    Java has single inheritance of implementation which means the the inheritance of classes is restricted to exactly one while you can inherit as many interfaces you like.

  • Am i missing somthing about speed and coverage please help very very slow speeds!

     i get speed test results of 1/10 of a megabyte per second all of the time regularly that is 100kbps  many times it is also like .06 mbps.  it takes forever to load web pages and i cant watch video!  i called verizon many times becuase i can get 5 bars of evdo. 2 miles away in the vzw store my usb modem worked fine (about 1mbps) and it works better at home like @ half a mbps speed in the early morning like @ 6am.  tech support told me after opening a trouble ticket they found this is a marginal coverage area and they will not be improving it in the near future.  i dont know how the coverage area changes from morning to the rest of the day.  i asked about possibly getting out of my contract and they said i had to still pay an early termination fee or produce a death certificate or military papers saying i was being deployed overseas. furthermore i was told since this is mobile broadband i should just go somewhere else when i need to use the mobile broadband card.  i had so much trouble logging into this site because verizon keeps saying my password and username for this forum is not correct so i have to keep trying to make new ones.  then somtimes just when i thought i had logged in it says the server is forbidden from accessing this site, which is the only time on any website i ever got this message.  i just wish i could get the speeds they aadvertise or somthing even close to it so that i could load web pages. i feel like i am being forced to change to another wireless provider and pay an early termination fee because i cant do basic work and load web pages which is what i was promised according to their map which says i live in a good coverage area.  i pay my bills on time every month and so i feel like i am not being treated fairly as a customer.  am i missing somthing?

    chinjing wrote:
     i get speed test results of 1/10 of a megabyte per second all of the time regularly that is 100kbps  many times it is also like .06 mbps.  it takes forever to load web pages and i cant watch video!  i called verizon many times becuase i can get 5 bars of evdo. 2 miles away in the vzw store my usb modem worked fine (about 1mbps) and it works better at home like @ half a mbps speed in the early morning like @ 6am.  tech support told me after opening a trouble ticket they found this is a marginal coverage area and they will not be improving it in the near future.  i dont know how the coverage area changes from morning to the rest of the day.  i asked about possibly getting out of my contract and they said i had to still pay an early termination fee or produce a death certificate or military papers saying i was being deployed overseas. furthermore i was told since this is mobile broadband i should just go somewhere else when i need to use the mobile broadband card.  i had so much trouble logging into this site because verizon keeps saying my password and username for this forum is not correct so i have to keep trying to make new ones.  then somtimes just when i thought i had logged in it says the server is forbidden from accessing this site, which is the only time on any website i ever got this message.  i just wish i could get the speeds they aadvertise or somthing even close to it so that i could load web pages. i feel like i am being forced to change to another wireless provider and pay an early termination fee because i cant do basic work and load web pages which is what i was promised according to their map which says i live in a good coverage area.  i pay my bills on time every month and so i feel like i am not being treated fairly as a customer.  am i missing somthing?
    If it works everywhere else, then it does sound like a marginal service area.  If no one is making use of the tower, then there could be a better signal to your residence in the morning.  During peak times, the signal might not be as strong and could be degrading to the point where your speeds/connectivity gets questionable.  Being inside a structure and what materials can also have an adverse effect.  Also, your verbage is confusing.  100 kilobytes per second is a pretty average speed for EVDO.  1/10 of a megabyte a second is the same speed.  Unless you are referring to .1 megabits per second, that is a whole different story.  I'm assuming the latter if you are having problems loading pages, but again, if it's a marginal area VZW is showing on their side, that's probably the case.  Also, the 3G map might not be the same as the Voice/1X map in your area.  Maybe double check the map you're looking at.

  • Questions on installtion and ram   please help! Pc tech with new Job!

    Im a Pc tech with a new job Im am in charg with a new Mac network . So Im great at PC.s just fuzzy on Macs.
    Here is my problem.
    IMac 17" flat panel.
    New Hard drive , new cable (IDE), Tryed to install New OS ( just OS X) got throught the first 5 mins in the installer , the it stoped and told me that it had encountered an error and to restart.
    Now I get an error 139 installer has unexspetanly stopped.
    Press return to reboot.
    Now pressing return never works have to hold start button to reboot.
    Ran hardware test of cd Im gettting a a mem_/2/4 error.
    I assusm that is a bad stick of memory? There is only 1 stick in there.
    I belive that its using pc133 256meg for memory.
    I have put a few pc133 sticks in the mac but none will work eather get a bad memory beep or no display .
    Does it have to mac memory or special latency ?
    Have opened the firmware and reset -all -nvram and defaults
    Have remove Air Port card and all other stuff , onlly keyboard and mouse and power cord .
    Does that sound right? If you need more info let me know.
    Any other clues?
    Any book that an tech like me (6 years fixing pcs) should read for macs? thanks for all your help in advance.
    James
    G5   Mac OS X (10.2.x)  

    Another thing to consider, a free to use download (donationware) is
    MacTracker; a small data base of Apple and Macintosh product specs.
    If you don't already have it, see: http://www.mactracker.ca to download.
    Some online manual sites had unauthorized copies of protected works
    and those sites were pulled from the internet; but they had service
    manuals in pdf for many models of computers. You may be able to get
    the official versions of pdf manuals through a subscription service for
    an annual fee; this may require searching and asking questions. It may
    also require an IT budget you may not have, to get a Mac-only archive.
    At one point I was given some technical support information to trouble-
    shoot my own ailing under warranty Apple computer(s) and the information
    is very helpful, when you have a need for the details they contain.
    I was careful to use them for non-invasive troubleshooting only.
    One older online source appears to have ftp:// links, but I was never
    able to make them work. The site may not have valid content or could
    be somehow blocked; so if you find such a site by searching for older
    Apple Manuals online, it may not yield anything. Or it may be illegal.
    Some of the low-end RAM chips can be problematic; I found at least
    one to add major issues in my iMacG4 and made it hard to diagnose
    another major hardware problem. Tossing the cheaper RAM (at retail
    was higher cost than decent RAM) was the best thing; got a better one.
    There should be a little information on boot ROM (firmware) per model in
    the MacTracker database you can use offline. You may need to know more
    about the use of Open Firmware in Macs. Hope this helps some.
    PS: for a time, you could get tech manuals on CD from places
    such as http://www.applerescue.com/ (they have OS installers
    on disc for sale there, primarily) and also a search of the web
    may get you a source of tech books for repair service.

  • Basic question about Flash video. Please Help

    Hello,
    Sorry for the noob question but I'm struggling with the basic
    understanding about the Flash video.
    I just need to reduce a large video file to a small size with
    a nice quality and the Flash Video Encoder does very god job with
    that. But when I double click the compressed .flv file it opens as
    a blank screen in the stand alone player without playing any video.
    I can use Dreamweaver to produce a web page playing the file, but I
    don't need this file for posting it on a web page, I just want the
    file smaller and to simply play it on my computer or send it to
    others.
    What is the way to do this?
    I appreciate your help.

    It sounds like you're not having problems with the actual
    compression of the videos, just the playback, correct? All you need
    is a standalone player that plays FLVs. Like Quicktime Player plays
    MOVs, and Windows Media Player plays WMVs, you need something to
    play the FLV files. There are many free options available. On a
    mac, I use something called, strangely enough, SWF & FLV
    Player. You can find it here:
    http://mac.eltima.com/freeflashplayer.html
    Just do a search for FLV players and you should find
    something appropriate. The only downside is you'll need to make
    sure anyone you're distributing the videos to also has an FLV
    player. If you're sending your files to just a few people, no big
    deal. If this is for the public in general, you would want to embed
    a Flash video player in an HTML page and send it like that.
    Hope that helps.

  • Question about ipohone 4s battery please help

    hi guys well i need everyones relpy please
    my new iphone 4s losing battery without even using it  !
    the iphone is on sleep mood and i am not doing any thing
    and i am losing battery about 1 % every 10 min
    so is this problem only in my phone
    or is it to all like the problem
    of the battery dying so fast
    or is it only a problem in my phone
    please guys i need you answers so i
    should know if i get it back to apple store
    and thanks

    I've got this same problem with my 4S Apple wants to kill my iPhone 4s

  • Questions about USDA Guaranteed Loan please help

     A coworker turned me onto the idea of this loan, as I'm looking to move from an apartment in South Tampa to a home in Ruskin.  My girlfriend and I are looking to rent currently, but if we can buy, that'd be much better.  Rent for homes we like are around $1300/mo.  We would likely have a roommate to help with bills, although we could afford it on our own. My girlfriend's income is tricky, which is why I'm making this post. 
    I make roughy 40k a year, at a steady county job.  My girlfriend is an in-home nanny, and is paid via check $700 a week.  She files taxes, and incurs a self employment tax, although she should be a W2 Employee under Nanny Tax and other regulations.  That's beside the point. She recently tried to refinance her car only to be told she was ineligible since she can't provide two years of self employment wages, since she had a W2 last year.  She is currently looking for a new job that will have a W2, but I'm worried a new job would potentially put us over the income limits. Here's my information: 1.Mortgage ScoresExperian-664Equifax-631Transunion-685  2.Credit NegativesPaid Charge Off $1100 BofA card.  Paid off Sep 2013, in full.  Showing 0 Lates.Low AAoA with new lines of credit after starting rebuild in 11/2013 3.Gross Income$40k annually 4.Source of IncomeFull Time Employment 5. Monthly Debt PaymentsCar Loan-$280Secured Loan-$87.91Credit Cards-~$50-150I use credit cards Sparingly, normally leaving small balances. 6.EmploymentW2'd Hourly as a Police Dispatcher4.5 Years employed and in field 7. Assets/ReservesSavings-$1000 give or take, just bought a lot of car parts for a project car.Checking-$1000401k/Retirement-$8000 If cars count, I also have a fully owned car worth about 7k  8.LocationFloridaHillsborough CountyRuskin 9.Property TypeLooking for a Single Family Home, either new construction or "used". 10.Property ValueLooking at 150-200k depending on qualifications and the house we find. 11.OccupancyPrimary Residence2 Occupants, girlfriend and me.  If 3 or 4 bedroom, one or two roommates respectively. 12.Transaction TypeFirst time purchase. 

    Thank you.  I'll add that information.  1.Mortgage ScoresExperian-664Equifax-631Transunion-685  2.Credit NegativesPaid Charge Off $1100 BofA card.  Paid off Sep 2013, in full.  Showing 0 Lates.Low AAoA with new lines of credit after starting rebuild in 11/2013 3.Gross Income$40k annually 4.Source of IncomeFull Time Employment 5. Monthly Debt PaymentsCar Loan-$280Secured Loan-$87.91Credit Cards-~$50-150I use credit cards Sparingly, normally leaving small balances.  6.EmploymentW2'd Hourly as a Police Dispatcher4.5 Years employed and in field 7. Assets/ReservesSavings-$1000 give or take, just bought a lot of car parts for a project car.Checking-$1000401k/Retirement-$8000 If cars count, I also have a fully owned car worth about 7k  8.LocationFloridaHillsborough CountyRuskin 9.Property TypeLooking for a Single Family Home, either new construction or "used". 10.Property ValueLooking at 150-200k depending on qualifications and the house we find. 11.OccupancyPrimary Residence2 Occupants, girlfriend and me.  If 3 or 4 bedroom, one or two roommates respectively. 12.Transaction TypeFirst time purchase.   

  • Questions about themes...please help!

    This is my first time using iMovie and I am trying to make a slideshow of pictures. For some reason it won't let me choose a theme for my pictures (only shows the titles and no "set theme" option. Is there a reason this button isn't appearing?
    Another question, is there a way to apply text to all of the pictures instead of dragging to the picture on at a time? I would appreciate ANY help.
    Thanks so much!

    Which version of iMovie are you on? You need 8.0.3 (iMovie 09) for themes.
    7.1.4 (iMovie 08) does not have themes.
    You can check by clicking iMovie/About

  • Question about image quality! *please help*

    Hello everyone!
    I'm actually a beginner at FCP, so sorry if this question sounds kinda dumb:
    I just shot a video in a DVX100, and imported it onto FCP. When I play the video
    on the viewer, the quality of the image looks just fine. When I put it on the timeline
    for editing however, the image quality drops quite a bit. How can I match viewer settings
    with sequence settings?
    Thanks a lot!
    Stef

    Step 1 would be to ensure the sequence settings match the source video settings. If the sequence is set to a lower quality size/codec than the original video, it will be reduced in quality in the timeline.
    What sequence settings are you using?

  • Simple question about sockets and streams - please answer it!

    Hi
    I have a server socket and a client socket. Both are up and runing. But I'm having problems to send a string from the client and read only the four first bytes on the server. Please read the code and some other comments below:
    socket client:
    DataOutputStream out =
    new DataOutputStream(socket.getOutputStream());
    // read from keyboard input
    BufferedReader myinput =
    new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Type any 4 chars and [enter].");
    String any = myinput.readLine();
    out.writeBytes(any);
    out.flush();
    server socket:
    in = new DataInputStream(socket.getInputStream());
    byte[] id = new byte[4];
    in.read(id, 0, 4);
    System.out.print(new String(id));
    According to the code, it should read 4 bytes from the input stream (in.read(id, 0, 4)), but it displays only the first byte. For example, if I type "hello" on client, the serve should show "hell" but it shows just "h"
    Any ideias? Thanks!

    Hi,
    Check the Javadoc for 'in.read(id, 0, 4);' This reads up to 4 bytes and returns the number of bytes read. You need something along the lines of
    int count = 0;
    while (count < 4)
    count += in.read(id, count, 4-count);
    Roger

  • Fundamental Confusion (about float and height) - please help

    hi. desired result is: a floated, fixed height and
    width div nested in another div with auto height and fixed width. but why does the mainbox div (see example) just collapse. am i missing a fundamental basic knowledge base here?
    <style type="text/css">
    #mainbox {width:300px; height:auto; background: #CCC}
    #mainbox .inside1 {width:100px; height:200px; float:left}</style>
    </head>
    <body>
    <div id="mainbox"><div class="inside1"></div></div>
    </body>
    </html>
    thanks.
    {Subject edited for clarity by moderator]

    mmm do divs not expand for floated content then?
    also, hans, i think you got the wrong thread.
    cheers

  • Question about iTunes store! Please help

    Ok, here is my problem;
    I want to buy a CD off of itunes, but I want the music on another computer.
    I want to be able to do this WITHOUT burning it on a CD, or transferring it from computer to computer.
    If I were to buy this CD on itunes and put it on one computer, is there a way that the iTunes store could remember that I had bought it? (With the multiple authorized computers.)
    I want to put the music on two computers, but NOT have to pay for the same CD twice.
    Help?
    Thanks

    Even though you may have up to 5 authorized systems to play your purchased content, store policy states that downloads can only be done ONCE. You must use a secondary method such as burning a data disc, using a flash drive, or external hard drive to transfer purchased content to another computer. This is policy & there's no way around it. Sorry.

  • Macbook wireless network question with vista and xp PLEASE HELP

    Ok I just bought a macbook computer and introduced it to a windows family using vista and xp computers. I was able to set up wireless networking and surf the internet with all computers. However I cannot see the windows computers from the mac but can see the mac on the windows computers. I have a linksys wrt54g router. I tried everything and Im unable to see other computers or the printer thats attached to the desktop pc using vista. I went ahead and purchased the extreme airport router and after being on the phone with apple care for 3 hours and reformatting the operating system on the mac I was finally able to see the other pc's and installed bonjour for windows on all windows based pc's and was able to print from the mac without a glitch but the windows based pc's were horribly very very slow printing using bonjour. Needless to say I didnt want to spend all the extra money on a apple router for all this to work and after doing so the printing from windows machines just plain *****. So I returned the airport extreme and Im back to the linksys. When the linksys wrt54g is hooked up I cannot see the printer or other windows machines. Any ideas please to keep my current setup so I dont have to go out and by more apple products for everything to play nice. Thanks

    What is the exact model number of your Linksys router for this Linksys forum??

  • 3 question about cookie and session please.

    1. I know that session automatic use in JSP by default and save session id in cookie. I have code that show all cookie on my computer
    <%
         Cookie [ ] listcookie = request.getCookies();
         Cookie mycookie = null;
         for(int i=0; i<listcookie.length; i++)
              mycookie = listcookie;
              out.println("<tr><td> " + mycookie.getName() + "</td>");
              out.println("<td> " + mycookie.getValue() + "</td></tr>");
    %>
    When I first run this code it now show cookie. But when I click refresh it show session cookie. Why it not show session cookie at first time?
    2. I use tomcat on window. Is session on server is save as file. Which directory it save?
    3. I use method getCreationTime() to check first create session time and method session.getLastAccessedTime() to check last access session time. I have to file
    showsession1.jsp
    first time create is <%=session.getCreationTime()%>  <br>
    last time access is <%=session.getLastAccessedTime()%> <br>
    <a href="showsession2.jsp"> showsession2.jsp</a>showsession2.jsp
    first time create is <%=session.getCreationTime()%>  <br>
    last time access is <%=session.getLastAccessedTime()%> <br>When I open browser and run showsession1.jsp first time create and last time access is equal when I click link to showsession2.jsp it also equal. Why it still equal because it is second time that I access JSP file? It change when I refresh file showsession2.jsp

    1. When I first run this code it now show cookie. But
    when I click refresh it show session cookie. Why it
    not show session cookie at first time?
    When you first request the JSP, the session cookie does not exist on your PC and so your browser cannot supply it which means that the JSP cannot display it. The session cookie is created when the JSP returns the response to the first request. The browser can then send the cookie on subsequent requests.
    2. I use tomcat on window. Is session on server is
    save as file. Which directory it save?How the server saves the session info is server dependent and it's unlikely you will be able to view it.
    3. I use method getCreationTime() to check first
    create session time and method
    session.getLastAccessedTime() to check last access
    session time. I have to file
    showsession1.jsp
    When I open browser and run showsession1.jsp first
    time create and last time access is equal when I click
    link to showsession2.jsp it also equal. Why it still
    equal because it is second time that I access JSP
    file? It change when I refresh file showsession2.jspProbably showsession2.jsp was already in the browser cache and so there was no request to the server until you refreshed

  • A serious question about app store. Please help ! A serious question about app store. Please help !

    Hi there. I have been trying to download apps from app store but it says that

    Go to the bottom right corner of the App Store window, click the round flag icon. Make sure you have the correct country selected.

Maybe you are looking for

  • How we will know the amount of issued P.O.

    Hi All please suggest me, When we issue a Purchase Order then there is accounting effect or entry. If there is no accounting effect how fi user  will understand from system how much Purchase Order has been issued. Because according to that the accoun

  • 0FISCPER3 - Default to last closed period in Report Variable

    Hi all, We have a requirement in our reports to default the Posting Period to last closed period. In the InfoCube we have 0CALMONTH (In Period) and also 0FISCPER3 (Posting Period). The values for Posting Period varies from 1 to 16. What is the functi

  • Bug in right click selection in reports

    Build 22.71, on Linux and Windows. When I go to, for example, the sessions report, and right click on a row which I want to invoke a trace session command on, the whole column where I right clicked get selected, so it does not correctly indicate to t

  • Elements 12 crash when sharing to Revel

    I have recently bought Elements 12 and was trying to upload all my 7000+ photos to Revel when some runtime error message came up that made Elements crash; when I reload Elements 12 it says it cannot access my catalog as it is being used by another pr

  • Proposal in different languages

    Do we have to take care of generating proposal in a particular language through java dynamic fields. Because we are generating the whole rtf document through java code.So in order to generate the proposal in a particular language , what do we have to