Question from package

hello i m a beginner in java trying 4 a job. Kindly help me in solving these question.
wat happens when you attempt to compile and run these  two files in the same  directory ?
//File P1.java
package MyPackage;
class P1{
          void afancymethod(){
          System.out.println("What a  fancy  method");
//File P2 .java
public class P2 extends P1{
          public static  void main(string argv[]){
          P2 p2= new P2();
          p2.afancymethod();
Options---
1.Both compile and P2 outputs "What a fancy method" when run
2.Neither will compile
3.Both compile but P2 has an error at run time
4.P1 compiles cleanly but P2 as error at compile time

Hi Payal,
Just check the file if it has closing braces. if the first file is
package MyPackage;
class P1{
  void afancymethod(){
   System.out.println("What a fancy method");
<b>}</b>
Then option 4 is correct ie. P1 compiles cleanly but P2 as error at compile time
But if there is no closing braces for the class P1 then option 2 is correct ie neither will get complied.
If you find my answers helpful, award points.
Regards,
Richa

Similar Messages

  • Access Variable on Main Timeline from Package

    I have set a variable on the root level timeline.  I have a movieclip that calls a package and within that package I want to call or access the main timline variable.  I have tried MovieClip(root) currentLabelName or just calling currentLabelName and none of that works.  Is there another way to be able to access it?

    I agree with dmennenoh that it's probably best not to mix the two, but let's start out assuming you do mix the two, and also the following
    Your instance is called assessment5Q
    You have a frame script on the same frame with the label you want to get.
    Your frame script might look like:
    assessment5Q.loadQuestions(currentFrameLabel);
    Your Assessment5Q Class would have a method that looks like:
    public function loadQuestions(label:String):void {
        //do your current load here
    Now that your Class is set up to work from a framescript, it will work from a Document Class without modification. However, it sounds like your instance doesn't exist on frame 1 of the main timeline, so you need to make sure you don't try to reference your instance before it exists. So we're going to make use of a getter/setter pair, which will allow Flash to create your instance on the timeline per usual, but when the setter is triggered you can then do things with the new instance. Your main document code would include code something like this:
    protected var _assessment5Q;
    public function get assessment5Q():Assessment5Q {
         return _assessment5Q;
    public function set assessment5Q(value:Assessment5Q):void {
         If (_assessment5Q != value) {
              _assessment5Q=value;
              If (_assessment5Q) {
                   _assessment5Q.loadQuestions(currentFrameLabel);
    Note that even this better way is not a way I'd recommend if you expect your project to take longer than a couple of days to develop or be maintained over more than a couple of weeks. It's not good practice to have a single Class that has the responsibility for both getting the data and displaying it. If you only have a single question format, you may be able to get away with having a Class that loads the questions and makes questions from it. Then you can pass the loaded questions into your View as above (instead of using a method that takes a string, you can use a method that takes an array of questions).
    It just so happens that I build Assessments as the vast majority of the work I do, and I have it broken down where there is a Class that has some number of Classes inside it that know how to build individual question types. That Class gets XML handed to it (from a different Class that just handles loading XML) and then it figures out which child Class knows how to build each question type and hands a snippet of XML to the appropriate child. Once all the questions are created, a set of questions will be handed into a View that can show between 1 and 9 questions. It does this by having individual question views on stage that, again, know about displaying specific types of questions. I'm not saying that you need to go whole hog into creating such a scalable design as I have. I'm just suggesting that your product is more likely to stand the test of time if you break things into smaller pieces that then cooperate. That way if the bigger pieces aren't quite right, you can put the smaller pieces together in a different way.

  • Tried to install OS X Yosemite on my MacBook. Got message that it could not be installed on my computer due to error while extracting files from package "Essentials.pkg". When i quit the installer as recommended it goes in a loop and gets stuck.

    Tried to install OS X Yosemite on my MacBook. Got message that it could not be installed on my computer due to error while extracting files from package "Essentials.pkg". When i quit the installer as recommended it goes in a loop and gets stuck.

    Hey corrafromlondon,
    Thanks for the question. After reviewing your post, it sounds like the installer file isn't working. Have you tried deleting the installer and redownloading the installer? I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    How to install OS X Yosemite on your Mac - Apple Support
    you can find the Yosemite installer app in your Applications folder or Launchpad. 
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Questions from a possible convert...

    My sad story: I used to run Gentoo, and honestly, I loved it once I finally got it installed on my Dell laptop. Then my screen went out. It was a hardware problem, but Dell wouldn't even look at it unless I reinstalled windows and removed Linux. So now, after getting the screen replaced, I'm back to square one, and really don't want to spend the next few days compiling Gentoo again.
    I've heard lot's of good things about Arch, but I haven't found answers to a few of my questions yet:
    1) Is Arch like Gentoo in that once it's installed, you never have to reinstall again? Just keep updating?
    2) Does Arch have all the little device drivers and things that are needed for laptop support?
    3) Does Arch use the 2.6 kernel "natively" yet?
    4) Are all of you as patient and nice as Gentoo users? 

    GaMMa wrote:
    I'm also considering coming here from Gentoo. I don't like the way the community has gone downhill and I have a feeling the leaving of the main man is going to cause some kind of turmoil.
    I also have questions:
    Are packages compiled from source and if not, is there REALLY any speed difference?
    Gentoo had ebuilds, how hard is it to make a arch ebuild type thing; are there any samples I can look at? I'd be switching to help the community.
    Are CVS builds possible under pacman?
    Does arch still solely use lilo? I had a choice to be here, or use Gentoo a while back, I tried both and went to Gentoo. Gentoo was more newbie friendly and you guys were just starting.
    I'm going to try the live CD out soon as it finishes downloading, then I'll consider scrapping my perfect Gentoo install.
    I don't quite understand your first question. Arch uses i686 optimized binary packages. On Gentoo you can optimize any way you like, but I don't think you gain anything from that except that you can run on older hw. The fact that Arch has a focus on keeping the system simple and not run unnecessary daemons is what makes it run faster than some other i686 optimized distros.
    To create a new package you can use /var/abs/PKGBUILD.proto as a basis (you may have to run abs first). Reading the install guide and man makepkg should get you going. There are also wiki pages on the topic.
    CVS builds are possible. Here's an example for waimea-cvs. Note that makepkg is what you build packages with, not pacman.
    Arch installs packages for both grub and lilo by default. I guess that makes it kind of bloated
    -bogomipz

  • Why can't I post a question from my new system?

    Hello All:
    I was just trying to post a question from my new mbp but it wouldn't allow me to do anything.  It continually gave me a message highlighted in 'red' that i was;t allowed to modify or post anything.  I've been asking questions for quite a while and have never seen this.  I also happen to have my older bmp, also logged onto the 'Apple Discussions' site, open beside me.  Can anyone explain this to me please?  BTW, my new system obviously has Yosemite on it while my older bmp has Lion.  Thanks in advance, to all those who respond.
    Regards,
    Ciaochiao

    ChitlinsCC, I'm adding your reloaders to my article on how to make using ASC easier.
    Here is my ASC work flow...
    1) I login.
    2) Block the automatic 30 minute logout.
         Unless you do something every thirty minutes you get logged out.  The forum software waits to tell you this as long as it can to keep you in suspense  ;-) . Filling out a reply is the exception to the thirty minute window.
            Start an auto reloader.
    Safari = SafariTabReloader
    Firefox = ReloadEvery: "Reload web pages automatically"
    Others = Reloaders | Cerberus - Support Center
      You need to pick a page that will reload over time without stalling out. It's ASC.  I've found my profile display the best to use. I get my Profile page after some  logins.  It's ASC.  Change rccharles to your apple id.
    https://discussions.apple.com/people/rccharles?view=discussions
    Reply technique
    Open a new browser window.  Pick some discussion.  Open a reply window.  As long as this reply window is open, you will stay logged in.  The 30 minute times is reset as needed by the ASC software.
    3) I open another window to do my normal ASC browsing.
    4) I have a FireFox bookmark to goto the discussions that I have participated in. I've modified it to add on the content stuff.
             turingtest2 recommends. Change rccharles to your apple id:  
    https://discussions.apple.com/people/rccharles/content?filterID=participated~obj ecttype~objecttype%5Bthread%5D
    5) Use turingtest2's generated links with the /content suffix as browser bookmark to the ASC discussions: 
    Site map of Communities and Categories
    https://discussions.apple.com/docs/DOC-2463
    6) Adjust the ASC web page layout.
    For FireFox
    I run with Hiroto's modification to user content.  This is the only way these forums are readable for me.  How to adjust the format and layout of ASC Web Pages:
    https://discussions.apple.com/docs/DOC-7501
    For Safari
    "ASCPowerTools is a Safari Extension designed to give more control"
    http://www.etresoft.com/ascpowertools
    7) Read and answer my old posts.  I kind of memorize the time I last posted. ( It's way bad that apple eliminated the last poster to a thread. )
    8) I use tabbed browsering.  From a list of discussions, hold down the command key then click on the link. You get two tabs this way. The original window will keep where you have been.

  • HT201272 I have recently picked up an Apple TV. When I go to the movies tab, there are less movies available there than there are in my i-Tunes account. I've done some looking around at questions from others, but haven't found an answer that works for me.

    I have recently picked up an Apple TV. When I go to the movies tab, there less movies available there than what is available in my i-Tunes library. I have 38 movies showing in my library but only 23 are showing in the Movies tab on the Apple TV. After researching this a little, there are only 23 movies showing under Purchased in the Quicklinks of my i-Tunes account. The majority of my collection are digital copy downloads that came from DVD purchases. Some of the missing movies were added in the past couple of months, the rest are a year-or-so old. I have done some looking around at questions from others, but I have not found an answer that will fix my situation. How do I update my library to get ALL of my movies to reflect that they were "Purchased"(as it says they were in their Properties)?

    Biggles Lamb wrote:
    Chill out guys, getting personal will never ever change another persons view, right or wrong, they are entitled to them .
    The pros and cons of to CC or not to CC have been done to death
    Its a fact the CC model will work for some, especially newbies and small businesses.
    The risks associated with the CC model have been well documented.
    For long term users of CS perpetuals its generally a large hike up in cost compared to the upgrade system.
    Then there are the....... Adobe can rot it hell...... group who will never subscribe
    To each their own, you do the math to suit your cashflow whatever that is and then make an informed decision
    To those on the CC model, I'd like to offer some practical advice.........do not allow automatic updates.........make regular backups............develop an exit strategy of alternatives for when you can no longer afford the subscription costs............never ever assume that the Adobe update is bug free
    Enjoy your cloud
    Col
    Thank you for that post, and the advice. I just happen to be one of those who it does work for. I've been around long enough to know that CC isn't going to work for everyone(the large publishing/radio/web company I work for isn't upgrading to CC because of the costs involved). But it does for me as I potentially venture out into the full-time freelancing world and away from the more structured big office environment. I can't make decisions based on what is best for anyone else, or what will hurt or help Adobe. Just what affects me, and that's all.
    Brent

  • May be slightly simple question from a new Mac user: Why can't I quit safari? I cannot quit it from top menu bar neither to do it from dock? All other apps are working normally.

    May be slightly simple question from a new Mac user: Why can't I quit safari? I cannot quit it from top menu bar neither to do it from dock? All other apps are working normally.

    Or you can actived the right button on your magic mouse and click on they icon in the dock. then you select "stop" and it's out of your dock.
    Greetings
    *update: Sorry, my mistake! I didn't read your message correct! Sorry for the inconvience!

  • Use of "NEW FROM PACKAGE" in SAP 8.8 And Master Layout creation

    Dear Expert,
    A)
    How to use "NEW FROM PACKAGE" option at time of choosing company.
    and also how to create .pak file ???
    Even I don't know by using this feature what are the scope.
    B)
    How to create master layout in 8.8 when I am using crystal Report.
    Thanks
    King Kevin

    Hi Kevin.....
    When you install SAP you have to install Solution Packager also. which will help you to create the .pkg file of your database which will then be used in New From Packager......
    And for Master Layout you can import the PLDs as you created independent Via. Reports And Layout. It will ask you the path to store the PLDs. Give the relevant path and your Crystal Report will be executed......
    Regards,
    Rahul

  • Error "Only edit objects from package /VIRSA/ZVIR in local requests"

    Hey, SAP gurus,
    After I applied OSS note 1149445 in our Dev box to fix the bug in program /VIRSA/ZVFAT, I had problem to realease the transport. I got the error u201COnly edit objects from package /VIRSA/ZVIR in local requestsu201D.
    u201CObjects in package /VIRSA/ZVIR cannot be edited in transportable Workbench requests in the current Dev system. The transport routes are configured such that objects from package /VIRSA/ZVIR can only be edited in local Workbench requests.u201D
    What can I do to release the transport and move it to our QA box?
    Thanks in advance!
    Fisher Li

    My co-worker and I followed SAP instruction on this one and solve the issue.
    We created a "transport of copies" by using Transaction SE01. Go to the request overview and choose Request/task -> Object list -> Include objects to include the "child transport number of my transport" in this "transport of copies". Add the target system and release the change request.
    Thanks!
    Fisher Li

  • Error : Only edit objects from package ZSD in local requests

    Hi Experts,
    We are modifying all Z-programs to unicode enabled programs in ECC6.0 Upgradation. While doing this we are not able to save it as a transportable request. It displays error as "Only edit objects from package ZSD in local requests".
    So can anyone tell me how to save it as a transportable request.
    Thanks,
    Ranjith C.

    Hi,
    two ways:
    1. change the transport type: create transport type copy in se01 and copy all mentioned objects to that transport
    2. better way: correct development class and transport layer
    case a.  target system was not definied (not known to TMS) or is empty
    case b.  source system (original system for objects) not known to TMS
    case c.  objects assigned to local package (former local development class)
    etc.
    If you don't understand this explanation, just use one of Z transport layers showed in stms, by changing the transport layer in the definition of the package (se80) to shown in STMS (link name from source to targed system)
    Kind regards,
    Mirek

  • TS2446 what do i do if i failed one of my security questions from forever ago from trying to buy a song after changing my password?

    I have been locked out and am unable to purchase anything. I just got a new laptop, and it asked me my security questions from forever ago. How do i fix this?

    Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • Snapshots refresh from package from another scheme

    *Also posted to Database:General!
    Hi all,
    i have a trouble while refreshing snapshots.
    First, i have a scheme where a package (for snapshots
    update) and snapshots themselves reside:
    package snp_update
    procedure update_snapshots
    is
    begin
    for s_name in ( SELECT owner, name
    FROM user_snapshots )
    loop
    dbms_snapshot.refresh (s_name.owner || '.' ||
    s_name.name, 'CA');
    end loop;
    end;
    end;
    Second, i have a scheme where reside only synonym to
    snp_update package (synonym name is syn_snp_update) and
    this scheme have granted 'execute' privilege on snp_update.
    But when i try to use it as
    begin
    syn_snp_update.update_snapshot;
    end;
    i have error: ORA-01031: insufficient privileges.
    But when i execute this pl/sql block from package
    owner's scheme - everything ok.
    Oracle: 8.0.5 on Sun Solaris 2.5
    Plz, help me.
    Maksym.

    How has your schema been granted the rights on SYN_SNP_UPDATE? A common cause of this problem is that the rights have been granted to a role. Oracle does not allow you to build procedures, etc using objects that you have been granted through a role. If this is the case you'll have to grant EXECUTE on SYN_SNP_UPDATE to your schema explicitly.
    Cheers, APCThrough
    grant execute on snp_update <synonym's owner schema>;
    BTW: Package's procedure is executing. Cursor (select ... from user_snapshots) retrieves first snapshot info in package's scheme and call to dbms_snapshot.refresh generates error.

  • Need recommend to build MB + CPU + VGA ....a question from Vietnam

    1st, sry my E is not good...
    My job is working with 60% Pr 40% Ae (full HD)
    I need recommend to help me choose 3 option
    CPU + MB (in VN they same price)
    1.   i7 950 + X58
    2.   i7 2600 + p8z68
    3.   2xE5520 + asus Z8NA (2nd)
    VGA (in VN they same price)
    1.   GTX 570
    2.   Nivida Quadro 1800 (because quadro 2000,3800,4800.. all supported is very difficult to buy it in VN) Quadro1800 can be GPU hacked ? (2nd)
    My PSU 750W
    RAM DDR3 Gskill buss 1333 4x4gb
    a question from Vietnam, need to help so much
    Thanks alot
    Waitting for Harm recommend

    I concur with Harm's recommendation. The Quadro 1800 is obsolete: It is based on the equally-obsolete GeForce 9600 GT but with only a 192-bit memory bus instead of a 256-bit memory bus. As such, the only memory configuration that was available on the Quadro 1800 was 768MB. Unfortunately, Premiere Pro CS5 requires a minimum of 765MB of free, unused graphics memory just to even enable GPU accelerated mode at all even with the hack. But since Windows itself eats up some of that 768MB, you'd be left with less than 750MB of free, unused graphics RAM with that Quadro 1800. As a result, Premiere Pro CS5 will be stuck in software-only mode even with the hack if you have the Quadro 1800 as the primary card.

  • HT5570 I do not remember the questions from my Apple ID to reset password

    I do not remember the questions from my Apple ID to reset password

    Hi Dima,
    If you are having issues with the Apple ID security questions, you may find the following articles helpful:
    Apple ID: All about Apple ID security questions
    http://support.apple.com/kb/HT5665
    Apple Support: Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/ht5312
    Regards,
    - Brenden

  • Security Questions from a Select List or Drop down Service Provider Edition

    Hello,
    Can we fetch security questions from the drop down or a select list in Service Provider Edition. We have a requirement to select multiple security questions during registration.
    Please advise.
    Regards
    Vinod

    HI
    Welcome to the Forum...
    You cannot put all the values in a single parameter field so you need to select each field for each parameter...
    Better you post it in this link for more reponses:
    Reporting and Printing

Maybe you are looking for

  • Pasting text into a text layer in Photoshop CC 2014

    I've been playing around around with Photoshop CC 2014 HTML5/Javascript extensions (CEP5) for a while now and I came across a problem I couldn't solve: how to paste text in an existing text layer when the user is editing the text? Using evalScript an

  • How can I unblock an e mail with popups?

    An email has been forwarded to me. I cannot open it and a window appears saying the browser is blocking popups. How can I unblock that particular e mail?

  • Wipe out Internal Mac Book Pro hard drive

    I need help on how to wipe out my internal Mac Book Pro hard drive. I used the Mac Office demo and now the demos are no longer usable. How can I wipe out the mac book pro hard drive? Should I contact my Apple Care service center for assistance, since

  • Help! White screen and will not turn on again!

    Can anyone please help? My phone is suffering from the infamous white screen of death about once a day now. The only response I can then get from it is if I do a battery pull. When I return the battery the phone starts to reboot but never finishes an

  • One page report.

    Dear SAP Friends, one common suituation is observed while doing implimentation project that is Owner required One page Report through the SAP System same as he get through the other ERP System or in Excell formate. Initially he is not ready to dropdo