• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A mock question

 
Yi Dong
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 28.
public class ADirtyOne
{
//char a = '\u000A';
}
An attempt to compile the above class
1. will complete successfully.
2. will compile sucessfully but with a warning message.
3. will not compile - complains on an invalid expression.
why the code can not be comnpiled, I thought // is commenting out that line of code, but when I try to compiled it, the compiler gave me an error.
Thanks in advance !
 
Anish Doshi
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Can you plz type d error for us so that we can know what it actually is.
 
Anish Shar
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if there is no body should it not be an abstract method in a abstract class
 
Yi Dong
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anish:
The error is:
ADirtyOne.java:4: unclosed character literal
}
ADirtyOne.java:4:<identifier>expected
}
Yi Dong
 
Tom Wolve
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
maybe it helps to know that unicodes like '\u000A' are replaced once before compiling.
So

will be

which will cause a compile error.
Greetings
Tom
 
Cathy Song
Ranch Hand
Posts: 270
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link might be useful..
http://www.javaranch.com/certfaq.jsp#q14
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic