Results 1 to 4 of 4
- 11-07-2008, 01:44 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 1
- Rep Power
- 0
getting identifier expected error . help me !
hi,
this is small program of adding two integers and storing in other integer.the program is not compiling .
public class additions{
private int a =5;
private int b=6 ;
private int c=9;
public void add(intm ,intn ) {
a=m;
b=n;
c=a+b;
System.out.println("value of summation is " +c);
}
public static void main(String []arg){
additions objadd = new additions() ;
objadd.add(7,8);
System.out.println("value of a before declared is.. " +objadd.a);
System.out.println("value of b before declared is .." +objadd.b);
System.out.println("value of c before declared is .." +objadd.c);
objadd.add(7,8);
System.out.println("final summtion result is " + objadd.c);
}
}
where is the error? tell me
- 11-07-2008, 02:50 PM #2
You forgot to post the full text of the error message. What was the referenced line number for example?
It sounds like you have missing pairs for {}, [] or ().
Check that they are all paired in your code.
- 11-07-2008, 04:14 PM #3
list of errors..
- the intm & intn arguments in the add method are not identified (they should be int)
- In the add method, variables m & n don't exist... they should be replaced with variables intm & intn.
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 11-07-2008, 05:49 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes, it's all about this line as CJSLMAN says.
Did you read carefully that error message you get? Most probably that error message should pointed this error.Java Code:public void add(intm ,intn ) {
Similar Threads
-
Identifier expected error
By vasu18 in forum New To JavaReplies: 1Last Post: 01-01-2008, 05:49 PM -
Error: ')' expected
By baltimore in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:32 AM -
Error: <identifier> expected
By barney in forum AWT / SwingReplies: 2Last Post: 07-31-2007, 07:38 AM -
Error: '{' expected
By romina in forum New To JavaReplies: 1Last Post: 07-26-2007, 09:34 AM -
MSG ERROR: : expected
By Marty in forum New To JavaReplies: 1Last Post: 05-31-2007, 02:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks