to access non-public data outside class getter methods be defined but we cannot define a method inside interface we can declared a method inside interface
Correct Answer: Interface data is static data why bcoz interface supports multiple inheritance if inteface data is non-static then there is chance for replication of the data (bcoz of replication of data ambiguity problem occurs )
Correct Answer: If we print any object by using println() or print() methods The println() or print() methods internally calls tostring() method and prints the return value of toString() method
6. How to create a file on the hard disk by using File class object?
Correct Answer: We can use the following method call: boolean createNewFile(); This method creates a new file on the HD If a file is already existing with the name given in the constructor then this method does not creates file on HD If file is successfully created then this method returns true If file is already existing on the HD then this method returns false This method may throw IOException whenever IO error is generated while creating file on HD
Correct Answer: To create directory on the HD we use mkDir() method: boolean mkDir(); This method returns true if the directory is created on HD This method returns false if the directory is already existing on HD
8. How to check that the file object is pointing a file on HD?