• 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

Question extended from marcus green

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
Visit http://www.jchq.net/mockexams/exam1.htm
and try question 26.Now I am extending the question(Java terminology :-) )
class test
{
public static void main(String args[])
{
String s=new String("Bicycle");
int iBegin=1;
char iEnd=3;
System.out.println(s.substring(iBegin,iEnd));
System.out.println(iEnd);
System.out.println(iBegin + iEnd);
System.out.println("Result With Concatenation of string is " + iEnd +
iBegin);
}
}
Ans:
F:\javasid>java wrap
ic
��
4
Result With Concatenation of string is ��1
Explanation : Above is a nice example of overloding of operator +
and widening of char as int when required otherwise.
Note
the java char value 3 may have distorted look in your browser.compile it and see ur self
Enjoy
Happy Christmas
anjan

[This message has been edited by anjan bhushan (edited December 23, 2000).]
[This message has been edited by anjan bhushan (edited December 23, 2000).]
[This message has been edited by anjan bhushan (edited December 23, 2000).]
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic