wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Guys Help me Out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Guys Help me Out" Watch "Guys Help me Out" New topic

Guys Help me Out

deepu Bhalotia
Ranch Hand

Joined: Apr 19, 2005
Posts: 39
class JSC201 {
static byte m1() {
final char c1 = '\u0001';
return c1; // 1
static byte m2(final char c2) {return c2;} // 2
public static void main(String[] args) {
char c3 = '\u0003';
System.out.print(""+m1()+m2(c3)); // 3

help me out in Solving this Question
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580

final char c1 = '\u0001';

now the value of c cannot be changed there after.
and determined at the time of compilation itself.
so byte b=c;
is same as byte b=1;
and no problem.


byte m2(final char c2) {return c2;}
the argument may be anything .
even it may exceed the range of byte.
and cannot be converted into byte implicitly.
so compilation error.
deepu Bhalotia
Ranch Hand

Joined: Apr 19, 2005
Posts: 39
Thanks Vidya....
I agree. Here's the link: http://aspose.com/file-tools
subject: Guys Help me Out
jQuery in Action, 3rd edition