The point of .newInstance()

Hi folks,
Correct me if I'm wrong, but wasn't the idea of declaring a class as "abstract" to keep people from creating instances of that class? Sort of creating an interface?
I just happened to stumble across an example in the xml-tutorial that told me to implement this
factory = SAXParserFactory.newInstance();line of code. Never having heard of this method, I tried to call the constructor using
factory  = new() SAXParserFactory;I was told that SAXParserFactory was abstract, hence could not be instanciated. But the API reveals that the method newInstance()
Returns:
A new instance of a SAXParserFactory
just like the name suggested it would... Where's the catch? I don't get it! Please explain to me the idea of having two calls do the same thing and to stop one of them doing it!?! What am I missing?

Hi folks,
Correct me if I'm wrong, but wasn't the idea of
declaring a class as "abstract" to keep people from
creating instances of that class? Sort of creating an
interface?
I just happened to stumble across an example in the
xml-tutorial that told me to implement this
factory = SAXParserFactory.newInstance();line of code. Never having heard of this method, I
tried to call the constructor using
factory  = new() SAXParserFactory;I was told that SAXParserFactory was abstract, hence
could not be instanciated. But the API reveals that
the method newInstance()
Returns:
A new instance of a SAXParserFactory
just like the name suggested it would... Where's the
catch? I don't get it! Please explain to me the idea
of having two calls do the same thing and to stop one
of them doing it!?! What am I missing?The method newInstance() in SAXParserFactory is static and is not abstract. Abstract classes can have fully implemented instance and static methods so this is not an unusual thing to see.
What happens is that you actually get an implementation of SAXParserFactory returned.
Check it out by calling
System.out.println("Class of impl returned = " + SAXParserFactory.newInstance().getClass().getName() ):

Similar Messages

  • Cursor moves when in tablet mode (screen touching the pointing stick on an X220T)

    Hi there,
    when I put my X220T in tablet mode, the screen moves just enough to move the pointing stick in the middle of the keyboard to cause the cursor to move. I can't rest my hand on the screen without causing the cursor to move all the way accross the screen.
    Am I missing a driver that would disable the nub when the screen is turned over it, or is this a design oversight? I've got the latest BIOS.
    Cheers,
    Kimmo
    http://vanhavirta.fi/
    Solved!
    Go to Solution.

    Nevermind, I was too hasty: https://forums.lenovo.com/t5/X-Series-Tablet-ThinkPad-Laptops/X220-TrackPoint-Wandering-in-Tablet-Mo...
    http://vanhavirta.fi/

  • I am extremely upset. I purchased my iPad in SA and I am traveling in Greece. When I want to make use of the free apps, I get a message that the app is not available in the SA store. What is the point of having an iPad if you cannot use it worldwide?

    I am extremely upset. I purchased my iPad in SA and now I am in Greece. I cannot download free apps as I get a message that the apps are not available in the SA store and only in US stores. When I change to the US store the same thing happens. What is the point of having an iPad if I cannot use it worldwide??? I feel that I wasted my money purchasing it as I specifically purchased it to use when I travel. How can I get access to all the available apps and why are they restricted.

    You can use your iPad worldwide. However, each AppleID is tied to
    a specific country's store. To use the AppStore in any country, you
    must be in that country and have a credit/debit card issued by a financial
    institution in that country with a verified billing address in that country.
    It is the developer's choice which AppStores he makes his app available
    from, and some countries prohibit certain apps.
    To make a purchase from the US store (including downloading a free app
    available in the US store), you must be in the US and have card issued
    in the US with verified billing address in the US.
    You can use your purchases from the SA store worldwide, but you
    cannot make purchases in other than the SA store unless you meet
    the aforesaid conditions.

  • I am having a recurring problem with my screen suddenly enlarging to the point where I cannot use it!  The power button is also unresponsive.  When it does work and the screen is large, I cannot access the slide at the top.....

    I am having a recurring proble with my screen suddenly enalrging to the point where it is unusable. The power button is also not working.  When I try to shut off the phone to restart it, I cannot swipe across the top to power off vbecause the screen is so big and unresponsive.  Can someone help me with this problem?

    Double tap the screen with three fingers to switch off zoom, then go to setting and disable it to make sure you don't switch it on again by accident.
    http://support.apple.com/manuals/

  • How can I plott data from a text file in the same way as a media player using the pointer slide to go back and fort in my file?

    I would like to plott data from a text file in the same way as a media player does from a video file. I’m not sure how to create the pointer slide function. The vi could look something like the attached jpg.
    Please, can some one help me?
    Martin
    Attachments:
    Plotting from a text file like a media player example.jpg ‏61 KB

    HI Martin,
    i am not realy sure what you want!?!?
    i think you want to display only a part of the values you read from XYZ
    so what you can do:
    write all the values in an array.
    the size of the array is the max. value of the slide bar
    now you can select a part of the array (e.g. values from 100 to 200) and display this with a graph
    the other option is to use the history function of the graphes
    regards
    timo

  • So I was trying to enhance my firewall to the point of inoperability and...

    Situation:
    Like what all really cool people do on a Saturday night, I was perusing the bowels of my unix stuff on my Mac last night, and did a sudo ipfw list. I noticed that ports 67, 68, 69, 137, 138, and 139 were open from any to any. I know that 13x ports are used for Windoze sharing, and that /etc/services shows those ports are for something to do with netbios and tftp. Windows Sharing did not show up as being enabled in SysPrefs Sharing Services, and no other services using any of these six ports showed up as being enabled in SysPrefs Sharing Firewall.
    I have no idea how or why those ports would be enabled. At work, I have Macs. My sons and daughter have Macs. Nobody would be connecting to my home network, either internally or from the internet at large and doing anything windoze-like. And I never recall having ever seen this ports opened before when doing a ipfw list.
    So, I got scared. I figured that I would do a sudo ipfw flush, which I did, and then just use SysPrefs Sharing Firewall to click checkboxes to reenable the services that I want. Well, that was the start of my enhancing my firewall to the point of inoperability. When I go into the SysPrefs Sharing Firewall panel, I get a splash screen that says something to the tune of "another firewall is active on this computer, so if you want to do anything here on this Firewall panel, turn off the other firewall software."
    Fortunately, I had done a sudo ipfw list > portList.txt so I could at least manually sudo ipfw add back the ports that I thought I wanted (and the ports I thought I wanted denied). So that's where I'm at now. But now it's a real annoyance that I don't have "checkbox control" of services and ports through the SysPrefs Sharing Firewall panel anymore, and instead have to do the "sudo ipfw add/subtract/multiply/divide {rule#} {whatever}" thing now. I don't know how to regain control of my Apple firewall and the SysPrefs Sharing Firewall panel.
    Of course this doesn't address the issue of what opened those ports, and if it happens again, an "archive and reinstall" of the OS, along with an install of fink/macports tripwire, may be in order. But that's an inconvenience to have to do, and hopefully I can avoid having to do that. In the meantime, regaining control of my Apple firewall and the SysPrefs Sharing Firewall panel, would realy be nice, and that is my question. What do I do, and how do I do it?
    Thanks in advance.

    First, take a deep breath...
    For one, the System Preferences knows nothing about the command line ipfw changes that you made. It expects to be the interface for setting and changing firewall rules, so when you've changed them manually (ipfw flush) it sees that the current rules doesn't match what it expects and hence the error message.
    Secondly, the presence, or otherwise, of those ports does not mean they are active. Just that ipfw isn't blocking them. There still has to be some process on the machine listing to the port in order for anything to actually happen. It's akin to leaving a door open - it's fine when all that's behind that door is a brick wall.
    A better test is to see what's actually being used on your machine, and ipfw cannot tell you that (at least, not easily). Better tools include netstat and lsof.
    netstat -a will give you a list of every network connection in use. Just don't be shocked if there are more there that you expect - the OS uses a lot of them internally. What you're most interested in is the ports in LISTEN state (piping the output through 'grep LISTEN' is a simple solution).
    Now you can focus on which ports your machine will actually respond to (assuming the firewall also allows traffic through).
    If you have a port number that you don't recognize then you can invoke lsof which has the ability to list all open files, network ports, etc. To track a port number, use the form:
    <pre class=command>sudo lsof -i :port</pre>
    This will tell you any process that is using the specified port number. From there you should be able to determine whether or not there's an issue.

  • What is the point of Mission Control?

    I have been a Mac user since 1987, when I got my first SE/30.  I understand a LOT about the Mac OS, and I consider myself and expert. For the life of me, however, I cannot figure out the point of Mission Control (or Exposé or Spaces, for that matter).  Let me explain, and ask if anyone here can clear this up for me.
    As I understand it, the point of Mission Control is to make it easy to access various open applications in an uncluttered workspace/desktop.  If this is the case, then how is this better than, say, Quickeys, which I have used forever? 
    In other words, I typically use the following applications, all open at the same time: Word, Mail, Safari, my office accounting program, iTunes, iChat, and maybe one or two more.  I use Quickeys and have assigned a keyboard shortcut for each - for example, control-E for mail; control-s for Safari; control-W for Word, etc.  It is second nature for me to immediately go to, say, Mail by pressing control-E.  Bringing the app to the front is literally instantaneous.
    I "get it" that, say, Safari can show below Mail, or iTunes can show behind Word, but that (multiple windows partially overlappiong each other) has never bothered me - indeed, I've never even considered it something worthy of worry.
    Thus, my question is, how does Mission Control do this - navigation of open applications - better than Quickeys? Is it simply and only to avoid the "behind the window clutter"?  If so, is the contortion needed to activate Mission Control - removing fingers from keyboard, clicking mouse, navigating mouse to proper desktop, and returning keys to keyboard - worth it? If so, how?  There has to be something else to this Mission Control that I am just missing.
    Could one of you enlighten me?
    Thanks!

    Different people have different ways of working and long ago I discovered the joys of virtual desktops (think mission control). Since System 7 (when the multi-finder stopped being optional) I've been keeping lots of programs open at the same time. The problem with that is the desktop gets very cluttered very fast and getting to the right window of the right program can be challenging. Thankfully between 3rd party tools and Apple's own built in tools we have many ways of dealing with this. Mission Control (virtual desktops) is one of them.
    I have assigned related programs to a single desktop. I have the Programming Desktop where the terminal, BBedit, Racket, and Xcode tools live. I have the Writing Desktop where Pages, Word, and InDesign live. And so on. This cuts down on the clutter of my display since only a couple programs appear on a single virtual desktop. Where Mission Control itself comes into play is when I need to get a resource from one Desktop to another. Say I'm writing an email and need to refer back to a document in Word. I might open the document in Word (which would move me into the Writing Desktop) then I'd shift to Mission Control and drag that Word document's window into my Internet Desktop so it would temporarily reside along with Mail so I could look at both the Word document and my email.
    It isn't the only way to work but I've found it very convenient and indispensible on my notebook. On my work desktop where I have two displays my workflow is a little different since I have lots of REAL window space.

  • What is the point of the download window if you use stacks?

    Greetings,
    One of the most annoying things about the download window was the fact that the window always hung around after completing dowloads in Tiger when using safari. To me, that was just a time waster of always pressing Apple+W to close that window.
    When Leopard was released, I was excited to realize that one function of the download stack was to recevie downloads from safari after completed. However, after completion, the download window still sticks around and I still have to close it... then navigate to my stack of downloads to mount the image. What is the point of the download window is I use stacks now? Why can't the window disappear after completion?
    //Cheers

    Aaargh!! Me too - it's so annoying! Firefox has a downloads window as well - I just don't see the point of it. I didn't like it in Tiger either.
    As a way to see the progress of downloads, it's fine, but it should at least close when all the downloads are finished, and completed downloads should not display.
    Ideally it should look & work exactly like the Copy window in Finder - the one that comes up when you are copying or moving a large file or number of files from one folder to another.
    Is there a hack that will make it work like that?

  • Why does the mouse 'run' to the lower right side of desktop and freeze when a SmartBoard is plugged into the USB port.  Running 10.8.5.   Sometimes the pointer has a cloud under it but it always freezes.

    I run SmartBoards connected to iMacs running 10.7 and 10.8 throughout my school.  On one of these computers the mouse has recently started freezing the minute a SmartBoard is plugged in to the USB port.  The mouse 'runs' to the bottom right side of the screen, a cloud often is under the pointer, and it is not longer interactive.  You can move the mouse upward a bit with the cloud following some of the time but it does not work.  Once the SmartBoard is unplugged the mouse works normally.  This particular computer worked fine with the SmartBoard until recenlty.  Any solutions or ideas?

    1. Reset the Pram and SMC
    http://support.apple.com/kb/ht3964
    http://support.apple.com/kb/ph14222
    If these don't relate to your computer a quick web search will get you details
    2. Run the Disk Utilty to verify the disk and then repair permissions.

  • How can I display date+time and not the point number in excell?

    Hi everyone,
    Could anybody tell me how I can save date + time to a file, so that  I can display on a diagram(excel) : date+time in (ox) and data (oy)? :
    My program sets in (ox) the point number and not the date+time....( although  date and time are written correctly in the column...)
    Any help would be great,
    Thanks,
    regards,
    Marc

    hi there,
    excel uses 01.01.1900 00:00 as the time offset, LabVIEW uses 01.01.1904 02:00, so you can't display the correct datetime in excel when you write the time as a fractional number of seconds from LabVIEW. you must format the datetime in LabVIEW to a string and write that to the column. use the "Format Date/Time String" - function and for example "%d.%m.%Y %H:%M:%S%3u" as the format string (see the functions help for more examples). you also could format your data to a string using "Format Into String" - function and write the file as a 2D string array. the decimal point you have to use depends on your system and its settings, but you can specify the decimal point in the Format string like "%.;%f" (means fractional number with point as decimal point).
    best regards
    chris 
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • HT5012 I have a first generation Iphone 5 and my question is why is my phone heating up so bad to the point where its almost to hot to touch on the back. On top of that the battery is dieing so fast that it usually lasts about 3 hrs on a full charge. Help

    So basically my iPhone 5 has been heating up so bad that it feels like its about to over heat and die. I've never had this happen to any other of my iPhones.  On top of that the battery is dying so fast that on a full charge is lasts about 3 hrs give or take. Ive tried closing all my apps like i usually do anyways, i tuned down the light, I've reset it and booted it back up, reset it and used iCloud backup, ext... Nothing is working. I'm to the point where i  almost want to get a new phone. I even tried calling apple support and they couldn't help me cause from what it sounded like they had no idea what they were doing. If anyone has any comments on how to fix this i would greatly appreciate it . I do love apple products and i have a upgrade and plan on upgrading my phone when the new one comes out but for the time being IDE like to fix the phone i have now that I've only had for a little bit anyways. Thanks  

    You are probably going to have to take a trip to the Apple Store, but you can also make sure that:
    Bluetooth is turned off when not in use
    Location Services are only turned on for those locations that you want a constant update to
    Background App Refresh is turned off
    Automatic Downloads is turned off
    Cellular Roaming is turned off when you don't need it
    Go through your Settings and take a look at all of the settings to determine if you have any turned on that may be using a lot of battery, and which you really don't need.
    Cheers,
    GB

  • My wifes iphone was too full to record a video so I upgraded her cloud storage to 20g and did mine at same time. Cloud is showing 15g free storage butshe still cannot take any mor photos as "not enough memory" What is the point of paying for the extr

    My wifes iphone was too full to record a video so I upgraded her cloud storage to 20g and did mine at same time. Cloud is showing 15g free storage butshe still cannot take any mor photos as "not enough memory" What is the point of paying for the extr

    Hello Pushtheriver,
    After reviewing your post, I have located an article that can help in this situation. It contains a number of troubleshooting steps and helpful advice concerning iCloud storage issues:
    Get help using iCloud storage
    This may also help:
    Understanding iOS device capacity
    You can sync and download many different types of content on your device. Some types of content (such as music and videos) typically take more space than others (such as notes and books). The amount of space taken by an app depends on the app's purpose; complex or graphically intense apps usually take more space than simpler apps.
    If your device is near its capacity, you can remove some of the less used content to make room for more.
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • I pre-ordered an iPhone 6 Plus and the delivery date now says October 14th. The point of the pre-order is to get it on release day (or shortly thereafter). Can I go to a Verizon store to pick up my new phone on release day?

    I pre-ordered an iPhone 6 Plus and the delivery date now says October 14th. The point of the pre-order is to get it on release day (or shortly thereafter). Can I go to a Verizon store to pick up my new phone on release day?

    I'm not sure that answers the question Candice.
    I'm in the same situation.  I was up trying to get on the Verizon page at 11:55, kept getting the ECPD error.  When finally got through, the Silver Iphone Plus 64 showed arrival of 9-19.  At every step of the process, it seemed that I was ordering a phone that would arrive on day1.  At no point did it say this was an estimate.  At no point did it say it might change.  In a big yellow box, it said "9-19".  Ordered it, then got confirmation email stating it should arrive at 9-19.   Seems like all should be good, right?  Order site said 9-19, I've got a confirmation email saying 9-19, done and done.
    Then I check the website, and suddenly it changed to 10-14?!?!?!?  I feel like this was a bait and switch.  I was able to pickup an iphone5 in a local store on launch day, and would not have locked myself into a preorder through Verizon if I had known this would happen!
    So, that leads back to the original questions.  Lets assume I walk into a Verizon store on 9-19, and there is an available iphone6 plus just sitting there, can I either get that phone as fulfillment of my pre-order.  Or, cancel my pre-order and buy that phone right then and there?
    JJK
    PS:  It seems there are many people you misled this way.  For every person who takes the time to post on this site, there are going to be many many more who are silently ****** off.

  • I have always paid for apps with a credit card and now need to use an app store card but I can't get past the point where it keeps wanting my credit card updated.  And can't used the app card number.  Any advice???

    I have always paid for apps with a credit card and now need to use an app store card but I can't get past the point where it keeps wanting my credit card updated.  And can't used the app card number.  Any advice???

    I do NOT like using my credit card if I don't have to, and I went out of my way to go buy an Apple gift card, which I successfully redeemed into my Apple account. However, when I use the Apple "Cards" app, it will not let me use anything other than my credit card. I tried purchasing a card, hopefulling it would come out of my Apple store balance, but no such luck -- it came out of my credit card.
    Apple is becoming more like Microsoft every day.

  • What's the point of warranty?

    I am a student coming from Hong Kong  to London for postgraduate study. Before I left Hong Kong, I decided to buy a netbook for my lecturers in the UK. Lenovo s10-2 was chosen because the version available in HK comes with 6 cell battery with international warranty and Lenovo Protection Service (against accidental damage).
    This is the first Lenovo machine for me. All was well and I was starting to appreciate Lenovo. Suddenly, the LED screen started to flick with white lines moving across the it, just two weeks after I bought it from Hong Kong.
    Yesterday, I called the UK support line who initially suggested replacement (because the purchase is last than 30-day old). However, when the agent found out that I bought the machine in Hong Kong, he said I could only get it repairs. Fair enough.
    I packed the netbook this afternoon ready to ship it to the repair center. Being not sure about whether or not my proof of purchase was needed, I called the support line again. This time, the agent gave me a "friendly warning" or maybe a management of my expectations.
    I was told that Lenovo believes that there is a 99.5% chance that these type of problems are due to “internal damages" caused by users! I was also advised that sending the machine in for repairs risk myself getting into paying 230 pounds (pretty much the purchase cost) to get the LED screen fixed because it is likely to be not covered by warranty. On top of that, I would have to pay 65 pounds even if I want my netbook back after inspection without getting fixed because again, 99.5% chance that "damages by users" would be concluded!
    What's the point of warranty? Totally unacceptable. Any thoughts? Should I take the risk?
    I only got the machine just over two weeks ago and used for less than 10 times!

    seblee,
    This bears a bit of looking into to provide you the best answer.   Sometimes, the accidental damage policies are only valid in the home country, and I would like to check.  If that were to be the case, you would have replacement or repair options in HK, but standard warranty terms would likely apply in UK.
    Your situation sounds exceptional, and I'd like to look into this and see what can be done.
    Can your send me a private message with your contact information and the serial number from the bottom of the unit?
    Sorry that you are having this trouble.  Will see how we can help.
    Mark
    ThinkPads: S30, T43, X60t, X1, W700ds, IdeaPad Y710, IdeaCentre: A300, IdeaPad K1
    Mark Hopkins
    Program Manager, Lenovo Social Media (Services)
    twitter @lenovoforums
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

Maybe you are looking for

  • HT6001 updated iTunes on intel iMac and now it won't open at all

    I'm using a 2007 intel imac 20" (2ghz intel core 2 duo) and itunes just updated automatically (to 11.1.4). Now it will not open, I just get an error message "iTunes quit unexpectedly" before it even opens. There seems to be no way to uninstall itunes

  • Bug Report & New Release

    HI, I'd want to know where can I signal a bug of BIBeans (should I open a Tar?...How can I do it?) and if is going to come out a new release of BIBeans.. Thank you very much in advance Antonio

  • PSE11 crashes when attempting to edit preferences

    When I run  PSE 11 Organizer and try and edit the Prefences a DOS screen flashes and the program crashes.  Any ideas as to cause / solution appreciated.

  • Epson Premium ICC profiles

    Epson provides Premium ICC profiles for their various papers for several of their photo printers. I have the R2400 and have downloaded the appropriate profiles. Unfortunately Epson will not comment nor provide support for these since they did not cre

  • TDS UTILITY NOT WORKING

    HI I am upgrading the SAP B1 2007B to SAP B1 8.8, I have download the  TDS upgrade utility But cannot able to run , i am getting the following error. The version of this file is not compatible with the version of windows you are running. check your c