home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Certification and Education
Ask a Tech Support Question (free)!

asking for identifier reuired in java

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1510
Discussions: 200,952, Posts: 2,379,481, Members: 246,320
Old April 17th, 2008, 08:05 AM   Digg it!   #1 (permalink)
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
allen6368 is offline   Reply With Quote
Old April 21st, 2008, 06:09 AM     #2 (permalink)
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;
tomherry is offline   Reply With Quote
Old April 21st, 2008, 06:22 AM     #3 (permalink)
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...
allen6368 is offline   Reply With Quote
Old April 21st, 2008, 02:19 PM     #4 (permalink)
THE Gimp Clown Fish!
 
nemowolf's Avatar
 
Join Date: Jun 2007
Location: Bay Area
Posts: 3,857
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++.
nemowolf is offline   Reply With Quote
Old April 28th, 2008, 07:44 AM     #5 (permalink)
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...
allen6368 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Launching Java webpages with different Java settings? LostBok Webmastering and Programming 1 December 11th, 2006 03:38 AM
Computer Unique Identifier. exally Webmastering and Programming 7 December 6th, 2006 08:46 PM
Switching Off P4 Identifier? ClubMed Processors, Memory, and Overclocking 6 November 25th, 2002 01:46 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2943)
The disrespect of Obama by Russian .. (41)
Making Health Care Worse (178)
Wireless Televisions. (12)
CPU fan stops spinning randomly (9)
Regular Build (11)
windows 7 problem (7)
Is the PSU I received dead? (12)
radeon x850xt platinum & shader.. (6)
Print spooler problem (15)
HIS HD5770 graphic card question (15)
windows vista security holes (10)
Install XP pro and a Vista laptop ?.. (11)
Foreign voltage (10)
Recent Discussions
tv not turn on-makes clicking sound (2)
SELLING FRESH,CVV,LOGINS,DUMPS,TRACKS.. (0)
CPU fan stops spinning randomly (9)
Common Spyware Solutions (105)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Modern Warfare 2: Who Bought It? (63)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Laptop with wireless problem. (3)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
windows vista security holes (10)
Point and Shoot Camera Suggestions. (4)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Hp Artist Edition + Matching Bag (0)
Asus P4G8X Mobo (6)
Xbox 360 GTA: SA disk error (1)


All times are GMT -4. The time now is 04:43 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28