Aruna Balasuriya

Ranch Hand
+ Follow
since Nov 14, 2009
Merit badge: grant badges
For More
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 Aruna Balasuriya

class A{}
public class B {

public static void main(String[] args) {

A[] a1 = new A[1];
A[][] a2 = new A[2][1];
a2[0] = a1;


}

}

Here a2[0] is it points to a1 array or it contains the value that a1 has ???
14 years ago
Why following code results a runtime exception

14 years ago
No one to help me
14 years ago


This prints AAA ??? How it Happen It should print ABC as c2 reffering to C type object. Please give me a detailed explanation.
14 years ago
Please give me complete set of overriding rules
14 years ago
One More Question

class Test2{
public void method() {}

public static void main(String[] args) {

char s1 = 9;
char s2 = '9';


System.out.println(s1);//1
System.out.println(s2);//2
}

}


Here line 1 prints nothing. Line 2 prints 9. Please Explain
14 years ago

Campbell Ritchie wrote:So many people have this delightful misconception that a char is a character. Well it isn't. It's a number. So you can do arithmetic with it. Exactly what you are doing there.



So why in line 1 it print a not 67(unicode value)
14 years ago

Embla Tingeling wrote:

Aruna Balasuriya wrote:Why ???



Please post the error message with your idea of what it means.



Compiler error says you cant override a static method in code below.But above one is also contain static methods.
14 years ago
What is meant by a literal?
14 years ago
public class Test3 {


public Test3() {
}

public static void main(String[] args) {
char x = 'a';
char y = 'b';

System.out.println(x);//1
System.out.println(y);//2
System.out.println(x+y);//3
}

}

line 1 prints a
line 2 prints b
but line 3 prints 195

but it should be ab.Please explain
14 years ago
Following code is legal




But following code is illegal





Why ???
14 years ago

Hiruka Sandev wrote:Yes. Like all other classes, the Thread class too extends from the Object class. So it can be considered and treated as a 'normal object' in java.



Then upon calling a start method of a thread object how a new method stack generated.
14 years ago
Are Thread objects are like any other Objects of java.
14 years ago

Hiruka Sandev wrote:You need not have it in the current directory if you have the path to your package (i.e the package to import) in your classpath.



Please Explain how do I do that
14 years ago
To import a package that create by me , should it be in the current directory where I run the program
14 years ago