|
1) Explain the following method of Character class
with example.
Consider for following question
(1).isDigit
(2).isLetter
(3).isUpperCase
(4).isLowerCase
2) What is StringBuffer? What is difference between String and StringBuffer? The StringBuffer is a class which is alternative to the String class. But StringBuffer class is more flexible to use than the String class. That means, using StringBuffer we can insert some components to the existing string or modify the existing string but in case of String class once the string is defined then it remains fixed. The StringBuffer and the StringBuffer are almost one and the same. The StringBuffer or StringBuilder have three constructors and 30 methods. 3) Explain various methods of StringBuffer class. (1).append
(2).charAt
(3).capacity
(4).delete
(5).insert
(6).length
(7).setCharAt
(8).replace
(9).reverse
(10).setLength
4) What is absolute filename and relative filename? The file name can be specified with its complete path
and drive letter. Such a specification of file name is called absolute
filename. For example – c:\test\myprogram.html where test is a current
directory in which myprogram.html
The file name is a file name relative to the current directory. That means while specifying the relative file name we should not mention the complete path of the corresponding file. For example – new File(“myprogram.html”); 5) What is this reference? Sometimes a method will need to refer to the object that
invoked it. To allow this, Java defines the thiskeyword. this can be used
inside any method to refer to the current object. That is, this is always
a reference to the object on which the
To better understand what this refers to, consider the
following version of Box():
6) What is difference between Methods and Constructor? A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. |
|
See also
Ask It in The Java Forum Java Books
Return to : Java Programming Hints and Tips All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|