• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JQplus

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
package other;
public class Other
{
public static String hello = "Hello";
}
package testPackage;
import current.other.Other.*;

class Test
{
public static void main(String[] args)
{
String hello = "Hello", lo = "lo";
System.out.println((Other.hello == hello) + "");
System.out.println((other.Other.hello == hello) + "");
System.out.println((hello == ("Hel" + "lo")) + "");
System.out.println((hello == ("Hel" + lo)) + "");
}
}
the answer given is true true true false true.
I don't understand this answer. Cananyone expalin the rules behind how to identify the answers.
Q.2)
Can anyone can give me the link where sources of different types of events ? MenuComponent class and its subclasses can generate which type of events?
Thanks in advance.
Q.3)
The following code snippet will not compile
int i = 10;
System.out.println(i<20? out1() : out2());
Assume that out1 and out2 have method signature:
public void out1();
and
public void out2();
the answer given is true.
I don't understand this answer. can anyone explain this in detail?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It won't compile becuase out1() and out2() don't return anything. System.out.println(out1()) says "print what's returned from out1(). The signature needs to be
public String out1();

Originally posted by shabbir zakir:
Q.3)
The following code snippet will not compile
int i = 10;
System.out.println(i<20? out1() : out2());
Assume that out1 and out2 have method signature:
public void out1();
and
public void out2();
the answer given is true.
I don't understand this answer. can anyone explain this in detail?
[/B]


 
shabbir zakir
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI!
past one day and only one answer.Please reply i am in hurry.
Thanks in advance.Where is PaulAnil. I am waiting for your help.
Thanks in advance.
 
Enthuware Software Support
Posts: 4803
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read 3.10.5 String Literals"
-Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus

Try out the world's only WebCompiler!
www.jdiscuss.com
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic