import java.io.*;
class Demo
{
public static void main(String args[])
{
File f=new File("1234.msg");
String arr[]=f.list();
System.out.println(arr.length);
}
}
Answer Posted / sri
this code gives Nullpointer exception
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is nan inf?
Is an array a vector?
Is empty set an element of empty set?
What is a string what operation can be performed out with the help of a string?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
Why hashmap is used in java?
Is it possible to override the main method?
What is constructor in java ?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
What is a void method java?
What are the different types of data structures in java?
What is finalize()? Is finalize() similar to a destructor?
What is boolean logic?
What is a short in java?
How do you escape json?