What is the error in my program....

class Inher {
int a;
a=2;
class Sub extends Inher
     int b;
     b=a;
Errors are:
C:\Users\Anish\Documents\Inher.java:4: <identifier> expected
a=2;
^
C:\Users\Anish\Documents\Inher.java:12: <identifier> expected
b=a;
^
2 errors

Tomas_Rosicky wrote:
thanks for the answer .......but why should the variable definition has to be in the method.Because statements have to be in method.
You can initialize variables and as part of the declaration, but you cannot make separate assignments.
public class MyClass{
  int i = 4;  //this is fine and preferred by many.
  Integer j;  //this declaration if fine, but the object has not been initialize yet and will complain if you do not do so in the constructor.
  int k;     //this is also fine and as an atomic value--will be initialize to 0.
  Integer p = new Integer(55); //correct declaration and initialization
  k = 3;   //this is an assignment statement, not part of a declaration and will err out.
  MyClass(){
    j = new Integer(2);  //this initializes the object appropriately.
}Note: untested code typed with fat fingers in the wee hours of the morning.

Similar Messages

  • What is the error in this program??????

    class FindArea
    public static void main(String args[])
    float radius=7.0f;
    float area=(22/7)*(radius)*(radius);
    System.out.println(area);
    When i execute the above program i am getting output as 147.0 why it is happening???? I dont understand.....
    Actually it should come...154!!!!!!!!

    When you divide one int by another the result is "truncated" (the decimal part is
    thrown away). If you don't want this to happen you have to tell the compiler to
    treat your integer as a double (or float). This is done in the first two cases, but not
    the third.public class IntOrDouble {
        public static void main(String[] args) {
                // prints 15.0
            double answer1 = ((double)3 / 2) * 10;
            System.out.println("answer 1 = " + answer1);
                // prints 15.0
            double answer2 = (3.0 / 2) * 10;
            System.out.println("answer 2 = " + answer2);
                // prints 10.0 because 3/2 is 1
            double answer3 = (3 / 2) * 10;
            System.out.println("answer 3 = " + answer3);
    }Test: so, what will (double)(3/2)*10 print?

  • What will the error in calltransactionprogram in dat upload?

    hi all
    what will the error in calltransaction program in dat upload, when that flat file field are not match with the ,internel table fields. what are the common errors occured errors while data uploading by using  calltransaction methodfor a transaction.

    if you declare internal table as like quantity field then you will get short dump so you have declare internal table field as like char type.
    and if you mentioned wrong field name with respect screen field then you get valid error message state that
    field name is not input field.
    Thanks
    Seshu

  • What's the error??

    Hello All,
    Could some one tell me what is the error in this procedure?
    CREATE OR REPLACE PROCEDURE STUDENTS_COUNT AS
    TOT NUMBER;
    BEGIN
    TOT:=0;
    SELECT COUNT(*) INTO TOT FROM STUDENTS;
    CASE
    WHEN TOT = 0 THEN RAISE_APPLICATION_ERROR(-20001,'SORRY!NO STUDENTS FOUND');
    WHEN TOT >= 1 AND TOT <= 5 THEN RAISE APPLICATION ERROR(-20001,'ONLY FEW STUDENTS');
    WHEN TOT >6 THEN RAISE APPLICATION ERROR(-20001,'GOOD NO OF STUDENTS');
    END CASE;
    END ;
    Thanks
    Balaji

    Hi,
    First of all there in nothing much wrong in your procedure, Except the "When" clause should not be end up by line terminator ( i.e. ";" )
    So the correct syntax is :-
    CASE
    WHEN TOT = 0 THEN RAISE_APPLICATION_ERROR(-20001,'SORRY!NO STUDENTS FOUND')
    WHEN TOT >= 1 AND TOT <= 5 THEN RAISE APPLICATION ERROR(-20001,'ONLY FEW STUDENTS')
    WHEN TOT >6 THEN RAISE APPLICATION ERROR(-20001,'GOOD NO OF STUDENTS')
    END CASE;
    More over if you are Using Oracle 8i then oracle does not support Case Expressions in PLSQL. Even SQLs with CASE expression can not be used in PLSQL. But Oracle 9i version do support the usage of CASE Expression in PLSQL.
    Sp program your business logic which is supported by you current oracle version.
    Regards
    Ripudaman

  • Quickly!Quickly!Quickly!What is the error code mean? And how to solve it ?Please give your answer. Thanks

    What is the error code mean? Why is there an error?And how to solve it ?Please give your answer. Thanks!                                               
    ——1110340026
    Attachments:
    QQ图片20140403140655.jpg ‏108 KB

    Sannieboyyyy wrote:
    Could be me, but your VI is not working properly on the english version of LV. Can I suggest you to try programming in English in the future?
    Yes, it's you. The VI is working just fine, except for some cosmetic issues with the labeling. I don't think is is a valid suggestion to force somebody to program in a specific language, especially since LabVIEW supports all these languages.
    Here are the problems with the VI:
    If you don't want an amplitude of zero, you need to set the amplitude control to a nonzero value before running. Simple as that!. (You could also set the input range for the amplitude control to exclude zero or use a case structure to skip certain code if the amplitude is zero).
    You could also wire the error output to an indicator so it simply displays the errors, but keeps running.
    Your while loop is currently useless. You can delete it and the program function will not change. Use a stop button at the loop condition.
    Your while loop needs some timing so it runs at a reasonable rate. Either add a small wait or configure the signal generation to "simulate acquisition timing" instead of "run as fast as possible".
    LabVIEW Champion . Do more with less code and in less time .

  • What does the error detect LEDs on the K7T mainboard mean?

    What does the error detect LEDs on the "K7T Pro2 VER:1"  mainboard mean? I can't download the user's manual. My computer doesn't work now and this LEDs displayed "green red red green".
    Thank you, wonkanoby. I have download the user's manual at http://www.microstar.com.cn/download/manual/mb/K7T%20Pro2/K7T%20Pro2.zip

    which one and i will get it and look
    http://www.msi.com.tw/program/search/ser/SerConRes.php?DATA=1&SearchKey=k7t

  • What is the uses of this programe(accelerometer)?

    what is the uses of this programe(accelerometer) in N95 original or N95 8g and from where I can get it?

    This is Rotateme, but needs to be signed.
    http://www.bysamir.fr/rotateme/
    This is the movingball which just needs to be installed (doesn't require signing).
    http://research.nokia.com/files/MovingBall_Example.sisx
    Nokia N95
    V 20.0.015
    0546553

  • What is the best voice control program for macbook pro

    what is the best voice control program for macbook pro?
    i have lost the use of my arms and need full voice control.
    thank you.

    Welcome to the Apple Support Communities
    First, use speech recognition. It's installed on OS X, so you don't have to install a third-party app. See > http://support.apple.com/kb/PH11258?viewlocale=en_US

  • HT1491 Why do i keep getting the message 'Cannot connect to iTunes Store' when I have done every connection I can find? What does the error message (-1202) mean when I am on the iTunes site on my computer?

    Why do i keep getting the message 'Cannot connect to iTunes Store' when I have done every connection I can find? What does the error message (-1202) mean when I am on the iTunes site on my computer?

    Hi Velvalee,
    While there may not be specific information about that error, here is an article of steps for troubleshooting connectivity issues with the iTunes store:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    If that article does not help, there is a link near the bottom for an additional article of advanced troubleshooting.
    Cheers!
    - Ari

  • What is the preferred virus scan program for iphone? I believe that I have a virus. My phone will come on by itself and it appears to be recording audio. I have read about spyware/surveilance viruses that will record audio and take photos.

    What is the preferred virus scan program for iphone? I believe that I have a virus. My phone will come on by itself and it appears to be recording audio. I have read about spyware/surveilance viruses that will record audio and take photos.

    My phone is not jailbroken.  I don't know what you mean about hacked.   Maybe it is hacked?   This is what is happening: About three times over the past few months I've noticed that my phone while "off" will come on (light up) and the screen shows an arrow towards the bottom; an arrow such that you would see on various "players" in order to "play" video or audio, I've searched my phone and cannot find any app that produces this particular screen though. Once I pick up the phone when this screen myseriously appears out of nowhere and press anything, it goes away and goes to the standard "slider" front page to unlock the phone.

  • What is the best word processing program for mac?

    What is the best word processing program for Mac?

    That's an impossible question to answer - what type of writing will you be doing?
    Before we can point you in a direction you need to tell us what kind of writing you will be doing. As phrased, the question is a bit like "what's the best car?" Well few would doubt that a Ferrari is superior to a Honda minivan, but the Ferrari will not much use if you're dragging 4 kids, two dogs and the grandparents along.
    Academic?
    Word is the nearest thing to a standard format in the Humanties, but in the sciences and math you'll find Tex more useful for laying out formulas. The older Pages is quite good as a substitute for Word in many cases in the Humanties, but you'll have big problems with citations in the newer version. Apps like Nisus Writer Pro and Mellel are more powerful than Pages, but each have shortcomings. Scrivener and Ulysses are excellent drafting tools but you'll need a Word Processor for final layout. There are lots and lots of lightweight editors out there - Byword, iaWriter (and Writer Pro), OmmWriter - that have little functional use in Academic settings - poor or no support for citations for instance, or poor or no interoperability with Word - but which might be excellent for other uses.
    So, back to the key question: what kind of writing will you be doing?

  • What is the best word processing program for ipad2?

    What is the best word processing program for ipad2?

    I would recommend using Pages for what you are doing. It is the best one to use on the iPad itself, and has the ability to convert to an MS Word format. I know that it can do this through email, but I am also fairly certain you can import it in this format through iTunes, though you may need to convert it on the iPad itself.
    With iOS 5 and iCloud, I recommend kicking Word to the curb altogether and going with Pages on both machines. Not only will everything be more seamless, but iCloud will update the changes you make, on either device, automatically. And Pages is only 20 bucks through the App store for the Mac (OS 10.6.7 or later needed).

  • HT4650 what's the best free virus program for Mac?

    What's the best free virus program for the Mac?Not just for viruses, but removing all the duplicate folders and tuning up my mac.
    I'm not exactly sure what all the Activity Monitor stuff is, but I know when my
    Mac is sluggish and slow. Any ideas? (No, MacDefender is not a possibility)

    See Here  >  Antivirus Discussion
    And Here for keeping your Mac happy...
    http://support.apple.com/kb/HT1147
    http://www.thexlab.com/faqs/maintainingmacosx.html
    http://www.thexlab.com/faqs/performance.html

  • What Speed could i get & what are the errors

    Hi Everyone.
       I have just joined B.T & yesterday was my last day of the 10 day period.
       Bin looking at my speed it hasnt gone up alot but i keep getting all these errors on the hub info so i would like to ask what are the errors please & does the speed look about right for me thanks Nick..
     Short time for connection as B.T reset the Hub its a v3.0a
    ADSL Line Status
    Connection Information
    Line state:
    Connected
    Connection time:
    1 days, 06:08:58
    Downstream:
    4.931 Mbps
    Upstream:
    1011 Kbps
    ADSL Settings
    VPI/VCI:
    0/38
    Type:
    PPPoA
    Modulation:
    G.992.3 Annex A
    Latency type:
    Interleaved
    Noise margin (Down/Up):
    5.5 dB / 5.8 dB
    Line attenuation (Down/Up):
    46.4 dB / 27.7 dB
    Output power (Down/Up):
    18.5 dBm / 12.6 dBm
    FEC Events (Down/Up):
    126408871 / 3607
    CRC Events (Down/Up):
    102820 / 739
    Loss of Framing (Local/Remote):
    0 / 0
    Loss of Signal (Local/Remote):
    0 / 0
    Loss of Power (Local/Remote):
    0 / 0
    HEC Events (Down/Up):
    91458 / 730
    Error Seconds (Local/Remote):
    32083 / 501

    Just enter your down attenuation here- http://www.kitz.co.uk/adsl/max_speed_calc.php  there are things you can do to reduce errors like connecting to the master socket see if there is a difference, checking your wiring and housing of the hub etc. A explanation of errors here-http://www.kitz.co.uk/adsl/linestats_errors.htm
    Mortgage Advisor 2000-2008
    Green Energy Advisor 2008-2010
    Charity Health Care Provider Advisor 2010-
    I'm alright Jack....

  • What does the error "Unable to lock the following files:" mean?

    What does the error "Unable to lock the following files:" mean? After the colon in this error message, a path to the .icml file is listed. We are using InDesign CS6 with InCopy CS6 (Mac), assignment-based workflow, on a shared server.
    Thanks,
    Gita M

    Sounds like a permissions issue on that server.
    Bob

Maybe you are looking for