m Sabale

+ Follow
since Mar 22, 2005
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by m Sabale

the answer should be 4.
since class A is Public, JVM will implicitly assign public access modifier to constructor of A.
class maybe{
public static void main(String []args)
{boolean b1=true;
boolean b2=false;
System.out.print(!false ^ false);
System.out.print(" " + (!b1 & (b2=true)));
System.out.println(" " + (b2 ^ b1));

doubt::: in the 3rd println how can the output be false?in fact what the ^ operator does is check for only one true in the expression and it gets it from the b1 variable...?

question 2::::also im still not at clear with the & and | operators.

& and | always executes both conditions whatever is the output of 1st conditions. In & operation, eventhough 1st condition is false it 'll execute 2nd condition and in | operation, eventhough 1st condition is true it 'll execute 2nd condition. Exactly opposite is in Short-circuit &&, ||.

in 2nd print true is assigned to b2 =>> (!b1 & (b2=true))
so in 3rd println b1 and b2 both are true so true ^ true output is false

question 3:::could you please explain me the following code

class titanic{
public static void main(String []args){
Boolean b1=true;
Boolean b2=false;
Boolean b3=true;
if((b1 & b2) | (b2 & b3) & b3)
if((b1=false) | (b1 & b3) | (b1 | b2))
the output comes out to be nothing at all. please explain it step by step?

in 1st if condition
(b1 & b2) = false (b2 & b3) = false
so if( false | false & true) gives you false and so it 'll nt print "alpha"

in 2nd if condition
it assigns false to b1 so now b1 = false
(b1 & b3) = true
(b1 | b2) = false | false = false (since b1=false)
so final condition is if( false | true & false) gives false and it doesn't print "beta"

So no output for 2nd example
please go thru tutorials for if condition and how if handles boolean values.
for Eg:
boolean b = true;
if(b=false).... here it assigns false value to be..
but same is not true for int values like :
int b=0;
if(b=1)... compiler will gv error for this since it expects boolean value...
Hi Chandra,

I have gone thru assertion test. But I need some clarification and corrections::
Q 1) a,b should be static to use in static methods evaluateFirst(),evaluateSecond()
Q 7) how answer is C also?
Q 9) answer A,C are confusing. A says assert has been used inappropriately at Line 1 and C says assert has been used legally??
Q 10)answer A,D are confusing again. A says it's inappropriate use of assert in doStuff() and C says legal use of assert in doStuff()??
If you are not clear about assertion preconditions and postconditions, go thru the sun tutorial


ther is a clear explaination with easy examples
I am reating new xml fime using DOM.

TransformerFactory tf=TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
serializer.transform(new DOMSource(xmlDocument),new StreamResult(oswWriter));

Is ther any way to check whether DOM transformer has Finished generating xml file?