Surya B

Ranch Hand
+ Follow
since May 10, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Surya B

Hi
You cannot use sleep(10000) because
Exception java.lang.InterruptedException must be caught, or it must be declared in the throws clause of this method.
yield();--is ok
yield();resume();--is ok
Regading the first option suspend and resume in this case the only user Thread in the entire application is suspended indefinately and the suspended thread cannot unsuspend themselves,look at this discussion for further clarification
http://www.javaranch.com/ubb/Forum24/HTML/003783.html
Surya
Hi
Q1
What can you add at //....../?
//....../?
public class Test {
}
A. package myprog;-true
B. import java.AWT.*;-true
C. protected class Prot {}-false
D. class Another {}-true
E. public static int myData = 123;-false

A. package myprog;-true
B. import java.AWT.*;-false,it should be import java.awt.*;
c. protected class Prot {}-false
D. class Another {}-true
E. public static int myData = 123;-false
Class A {}
Public class B{}
This is OK as long as there is only one public class in the file
Surya
Hi
Just go thru the Java API,one of the constructor of the string class is
String(StringBuffer buffer)
Allocates a new string that contains the sequence of characters currently contained in the string buffer argument.
Surya
Hi
I think i understood your question wrongly,anyway coming to assigning int to char this happens to be a widening conversion,From JLS
byte to short, int, long, float, or double
short to int, long, float, or double
char to int, long, float, or double
int to long, float, or double
long to float or double
float to double
These are all the examples of widening conversions,as long as the int value is in therange which char can accept the compiler implicitly converts it into int,but if the int value is not in the range of char the it gives the compiler error saying explicit cast needed to convert int to char.For example this is fine char c=65000 but this will result in a compile error
char c=65555.Hope i am clear this time.
Surya
Hi
You are printing out
System.out.println(j);
System.out.println(b);
So what has line 4 char z= 1 got to do with the code,i think you know the class level variables get initialized to their default values in this case int j will be assigned to 0 and boolean b to false,so the given answer is correct.
Surya
Hi Anonymous
Congrats on acheiving the perfect score of 100%.
Surya
<The code gives NullPointerException on lines 8 and 17 <br /> whether line 7 is commented or not when the line is commented, what is the class of nI? Object,I guess. then why is it not displaying the class in line 8 and throwing an exception instead?>
Whether line 7 is commented or not the class level variables are initialised to null,in your program commenting or uncommenting line 7 has absolutely no effect and in line 8 you are calling the method getClass on null object and at this point of time the program will throw an exception and it won't even go into the if..else part,comment line 8 and then the program will print no.
Surya
Hi Baskaran
Congrats and all the best for your future java endeavors.
Surya
Hi
In the action event of Textfield try this:
TextField.setText("");
Surya
Hi Antra
You did it ,congrats and all the best for your future java endeavors.
Surya
Hi
What is the question,is it select all the correct answers (or) how do you set the priority of the thread,if it is the former your answer is correct and if the question is only about setting the prorities then i think the given answers make sense,what do you think?
Surya
Hi
When you add an additional component to the grid layout an additional column will be added.So in your question by default you have 2 rows 2 columns..so it will be something like
button1 button2
button3 button4
Now when you add an additional button,what happens(???) you will have an addtional column,so now we have 2 rows 3 columns,so now how do you think the buttons will adjust themselves
button1 button2 button3
button4 button5
So whats your answer now
Surya
[This message has been edited by Surya B (edited August 29, 2000).]
Hi
The answer as you have pointed out is D.
Surya