+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Apr 2008
    Location
    New York
    Posts
    11

    asking for identifier reuired in java

     
    Hi..
    I am new to java and need a help on this part

    I am declaring a variable as below and it is showing error.. as identifier required.. help me out to understand the reason behind the same..

    class abc
    {

    int a;
    a=10; // on this point it is asking for identifier reuired
    public static void main(String[] args)
    System.out.println(a);
    }

    as i have already declared int a, why cant i assign a=10 in the next statement

    Response ASAP .... appreciated..

    Thanks in advance

    Sorry if i have posted it in wrong category but the thg is i need a immediate help and am quit weired out

  2. #2
    Junior Member
    Join Date
    Apr 2008
    Posts
    23
    Your Question is that
    class abc
    {

    int a;
    a=10; // on this point it is asking for identifier reuired
    public static void main(String[] args)
    System.out.println(a);
    }

    here a is Instance Level varible so, you cannot access without any object.
    Define a object and write
    suppose you have Object obj
    obj.a;

  3. #3
    Junior Member
    Join Date
    Apr 2008
    Location
    New York
    Posts
    11
    Quote Originally Posted by tomherry View Post
    Your Question is that
    class abc
    {

    int a;
    a=10; // on this point it is asking for identifier reuired
    public static void main(String[] args)
    System.out.println(a);
    }

    here a is Instance Level varible so, you cannot access without any object.
    Define a object and write
    suppose you have Object obj
    obj.a;

    but how can it be.. that i can not assign a variable to it at this point.. as it is something which is being possible in c++ if i remember sooo...

  4. #4
    THE Gimp Clown Fish! nemowolf's Avatar
    Join Date
    Jun 2007
    Location
    Bay Area
    Posts
    4,936
    Quote Originally Posted by allen6368 View Post
    but how can it be.. that i can not assign a variable to it at this point.. as it is something which is being possible in c++ if i remember sooo...

    This isnt C++.

    TechIMO Folding@home Team #111 - Crunching for the cure!

  5. #5
    Junior Member
    Join Date
    Apr 2008
    Location
    New York
    Posts
    11
    Hi.. Friends...

    Thanks for all you reply's and feedback...

    I got the issue and the concept i was lancing to take on with...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Computer Unique Identifier.
    By exally in forum Webmastering and Programming
    Replies: 8
    Last Post: October 18th, 2011, 07:04 AM
  2. Launching Java webpages with different Java settings?
    By LostBok in forum Webmastering and Programming
    Replies: 1
    Last Post: December 11th, 2006, 03:38 AM
  3. Switching Off P4 Identifier?
    By ClubMed in forum Processors, Memory, and Overclocking
    Replies: 6
    Last Post: November 25th, 2002, 01:46 PM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews