pallavi pandey

Greenhorn
+ Follow
since Nov 06, 2003
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 pallavi pandey

I didn't pay much attenstion to the word 'clause' and i had my own assumptions.
Thanks for your explanation.
Thanks Harwinder.
class ifClass{
public static void main(String ags[]){
int a= 10;
if(a>0)
if(a%2==0)
System.out.println(a + " is a positive even number");
}}
class ifClass{
public static void main(String ags[]){
int a= 10;
if(a>0)
System.out.println(a + " is a postive number");
else
System.out.println(a + " is a negative number");
}}

--An if statement can have either an if clause or an else clause.
A'm I wrong in understanding the above statement??
One more qs on control flow statements.
Which statements are true?
Select the three correct answers.
a.The conditional expression in an if statement can have method calls.
b.If a and b are of type boolean, the expression (a = b) can be the conditional expression of an if statement.
c.An if statement can have either an if clause or an else clause.
d.The statement if (false) ; else ; is illegal.
e.Only expressions which evaluate to a boolean value can be used as the condition in an if statement.
Given ans: a,b,e

My ans: b,c,e and i think a is not too clear. It should be -
The conditional expression in an if statement can have method calls with a return type boolean.
and why c is not correct?
Thanks
The static nested class is tied only to the outer class, not an instance of the outer class.
From JAVA Certification Study Guide.... (Just for Exam purpose)
Char --> int --> long --> float --> double
byte --> short --> int --> long --> float --> double
This illustrates all the widening conversions.
( --> means "can be widened to" )
To determine whether it is legal to convert from one type to another, find the first type in the figure and see if you can reach the second type by just following the arrows.
Any conversion between primitive types that is not represented by a path of arrows is a narrowing conversion. These conversions lose information about magnitude of the value being converted, and are not allowed in assignments.
I think this is easy to remember but before taking a note do some coding.
[ November 07, 2003: Message edited by: pallavi pandey ]
Hey Peck,
Don't worry. It happens sometimes. One of my friends too missed the test with just one question and she took the test after couple of months with more passion and guess what, she scored 94. Now she used to say if i would hv done that one question correctly i would never get a chance to read again and i hv to carry my unsatisfactory score all thr' my life and now i'm veery happy that i missed first time. So never giveup.
BetterLuck next time. And always rememeber..
"Failures are the stepping stones for VICTORY".
"-" implies bitwise inversion which is simply inverting all bits(1's to 0's and viceversa) and then adding 1 to the result.
So, binary representation of
-1 is 1111 1111 1111 1111 1111 1111 1111 1111
-2 is 1111 1111 1111 1111 1111 1111 1111 1110
and so on...
[ November 07, 2003: Message edited by: pallavi pandey ]
Trying all possible ways.
And this compiles fine.

class Homer {
int doh(int i) {
System.out.println("doh(int)");
return 100;
}
char doh(char c) {
System.out.println("doh(char)");
return 'd';
}

}
class Milhouse {}

class Bart extends Homer {
char doh(char c) {
System.out.println("doh(char)");
return 'd';
}
}
class Hide {
public static void main(String[] args) {
Bart b = new Bart();
//Homer b = new Homer();
b.doh(1);
b.doh('x');
}
}
Anybody to clarify?
19 years ago

Originally posted by Abhimanyu Srivastav:

suppose classes, members defined in package1 are ALL declared as default/protected/ private. (no public data at all) then what happens if i tried to import this in other package. Does it give error?
package package2;
import package1.*;


No error i guess unless u bring classes/members in package1 into picture.
Thanks a lott friends.

Pallavi.
Thanks a lot.
Can u tell me which edition of Eckel, Bruce has this topic so that i can get it from libary.
And can anybody fwd link for online tutorial on nested, inner classes.
Thanks.
Unable to answer questions on this topic.
Can anybody suggest me a good tutorial on nested classes( static non static)?
Many many thanks.

Pallavi.
[ November 06, 2003: Message edited by: pallavi pandey ]