• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

please help !!!urgent

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys
please give the correct answer and explain the answer
ques 1 which method are legal method names
- public abstract method();
x public abstract void method();
- public void abstract Method();
- public void method() {abstract;/}
- public abstract void method() {/}

ques 2
which are valid native method declaration
x public native void myMethod()
- public native myMethod()
- public void myMethod(native)
ques 3
given below is valid or not
if (i-- \> 0) valid
"\>" what mean
ques 4
String s = "message";
Frame f = new Frame();
f.add(btn);
btn.addActionListener(
new ActionListener() {
void ActionPerformed() {System.out.println(s);}
}

String str = "Good";
String other = " "+"morning"+",";
str.append(other);
str.toUpperCase();
str += "guys";

)
f.pack();
f.setVisible();
 
bala_chocos
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
question 5
What are legal operations on s?
String s = "something";
A.s >>= "ok";
B.char c = s[4];
C.s += 3;
D.s -= "thing";
E.s = s + "good";
question 6
What is the output of the following
StringBuffer sb1 = new StringBuffer("Amit");
StringBuffer sb2= new StringBuffer("Amit");
String ss1 = "Amit";
System.out.println(sb1==sb2);
System.out.println(sb1.equals(sb2));
System.out.println(sb1.equals(ss1));
System.out.println("Poddar".substring(3));
The answer given is false, false, false, "dar".
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi bala,
Here is my answers,
ques 1 which method are legal method names
- public abstract method(); // False - no return type
x public abstract void method(); // True
- public void abstract Method(); // False abstract after void
- public void method() {abstract;/} // False
- public abstract void method() {/} // False

ques 2
which are valid native method declaration
x public native void myMethod() // True
- public native myMethod() // False
- public void myMethod(native) // False
ques 4
String s = "message";
Frame f = new Frame();
f.add(btn);
btn.addActionListener(
new ActionListener() {
void ActionPerformed() {System.out.println(s);} }
// U can't Use button btn before declaration
String str = "Good";
String other = " "+"morning"+",";
str.append(other); // String has NO append Method
str.toUpperCase();
str += "guys";
)
f.pack();
f.setVisible();
What are legal operations on s?
String s = "something";
A. s >>= "ok";
B. char c = s[4];
C. s += 3; // True
D. s -= "thing";
E. s = s + "good"; // True

Aruna
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
The answer to the third question :
ques 3
given below is valid or not
if (i-- \> 0) valid
"\>" what mean
Ans : Invalid.
"\>" does not mean anything. Java supports a few escape sequences for denoting special characters.
some of them are listed below :
'\n' for newline
'\r' for Return
'\t' for tab
'\b' for backspace
'\f' for formfeed
'\'' for Single Quote
'\"' for Double Quote
'\\' for Back Slash

am i right?

Thanks,
Sunitha. S
 
reply
    Bookmark Topic Watch Topic
  • New Topic