• 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

FileOutputStream and identifier \u0063

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

I have 2 questions
1. From a mock exam

Which of the following statements will create a file called test.txt in your current directory?

1. File f = new File("test.txt");
2.FileOutputStream fos = new FileOutputStream("test.txt");
3.RandomAccessFile raf = new RandomAccessFile("test.txt", "r");
4.RandomAccessFile raf = new RandomAccessFile("test.txt", "rw");

Given answer is 2 and 4.
My question is
FileOutputStream deosn't create a file right?It throws FileNotFound exception if the doesn't exist.

2. char \u0063='\u0063';
the above declaration is valid but how?
how \u0063 is considered as valid identifier?

Please can anybody explain this??

Thank you in advance
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

FileOutputStream deosn't create a file right?It throws FileNotFound exception if the doesn't exist.


Sure it does. Are you confusing it with FileInputStream?

About \u0063, see:

http://www.janeg.ca/scjp/lang/charLiteral.html
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.4
 
reply
    Bookmark Topic Watch Topic
  • New Topic