Sunteți pe pagina 1din 4

1.

A set of ready-made software routines that can be reused in new programs, is


called a Library.

2. Java offers three classes to work with character data.

1. Character class
2. String class
3. String Buffer class

3. Methods used to obtain information about an object are known as accessor


methods.

EX:The class string provides many accessor methods that may be used to perform
operations on strings.

4. If the argument is a negative value then the result will be min value of int type.

5.If the argument is not a number i.e.,NaN,then the result is a NaN.

6. Predefined classes are available in the form of packages. These are called the
Java class libraries.

Java offers many packages through its libraries.

EX;java.awt

java.lang

Java.util

7.Libraries are made available in a program through import statement.

import java.io.*;

8.The package by default imported in every Java program is java.lang.

9.The equals() compares the current string to the specifies string.

The equalsIgnoreCase() compares the current string to the specified string ignoring
case considerations.

10.The length() returns the length of the string.


The capacity () returns maximum no. of characters that can be entered in the
current string.

11. We need so many string methods for


comparison,e.g.,equals,equalsIgnoreCase,comareTo,CompareToIgnoreCase
because of the lexicographical comparison i.e. alphabetical order to words.

12. The string objects of Java are immutable i.e., once created, they cannot be
changed. If any change occurs in a string object, then original string remains
unchanged and a new string is created with the changed string.

13.import javax.swing.JOptionPane;

jOptionShowMessageDialog(null,”IP12CBSE”);

14.

15.i)jTextArea1=Go Green

India

ii)jTextField1=6

16.i)jTextArea1=Just Another

Day

ii) jTextField1=31

17.Text1=India Good Morning

Text2=India

18.Str1=Hello Dear Friend

Str2=Hello

19.jTextFiled1=8

jTextField2=6

20.String strPassword=”67890”;
int intPassword=Integer.parseInt(strPassword);

System.out.println(intPassword);

21.X1=PEACESPREAD

Type B:

1. String Buffer objects provide more flexibility than String objects because
you can insert or append new contents into a String Buffer.
2. The methods which are in StringBuffer class but not in String class.
Are:
append(x) method
insert(offset,x) method
setCharAt(index,c) method
delete(beg,end) method
setLength(n) method
reverse()method

3.The math library of java is available under java.lang package i.e. its class
qualified name is java.lang.Math.

4.Math.round(1.5) 2

Math.round(-1.5) -1

5.differencing null pointer.

6.TM=15

TN=80-15=65

jTextField2=15

jTextField3=65

7. welcome

WELCOME
welcome

wAlcomA

wABlcomAB

wABlcomAB

S-ar putea să vă placă și