• 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

please Help

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PROBLEM 1
for(char c=0;c<1000;c++)
System.out.println(c);
GIVES CHARACTERS UPTIL C IS 128, AFTER THAT IT GIVES '?'
WHY ?
IF IT'S RELATED TO ENCODING SCHEME, KINDLY EXPLAIN ?
PROBLEM 2
System.err is an object of PrintStream
Also err is a static member of System Class
Please explain the above given lines.
PROBLEM 3
if i declare run() as synchronized method in a class implementing
Runnable, it is fine, it works in a synchronized manner.
But if declare run() as a synchronized method in a class
which extends Thread, it does not work in a synchronized
way. ?

 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kapil,
I can help you with the first two questions.
1. It is related to the encoding scheme. You are probably using the 8859_1 encoding scheme in which only the first 128 characters are defined (ASCII characters). If you want a different encoding scheme you need to change your default.
2. The System class defines the following class variable:
public final static PrintStream err = null;
It is of type java.io.PrintStream. It is static so we can use it without creating an instance of System:
// Print error message
System.out.println( System.err );
Regards,
Manfred
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic