hi!!!
i am vijay,,,,
i joined the blog recentlly!!! because while finding a solution for a problem in java!!!!

this blog cleared my doubt!!! its nice blog

Welcome!

Its more of a forum...

Hi, welcome to the community!:)
Hope to see you around.
Enjoy your stay!

hi,,

i wanna ask one doubt in java 1.5
wats is the use of warraper classes????
how the integer.parseint() works wat does it takes as an input!!!!

and one more thing!!!!

while reading books i stuied that in java wat exer we give as an input is stores in the form of strings.... can u eloborate on it!!!!! if we give integer or float value is that also stores as an strings.... wats this string actually means is it like storing in the form of enlish alohabets or its like bits ??? pls eloborate

Its a bad idea to store integer values as Strings.

Basically strings are text. You cant do maths on strings

1 (integer) is not the same as "1" (a string). 1 + 1 = 2 but "1" + "1" = an error or "11"

Thanks for that clarification!!! on more thing:

what is the use of the wrapper classes!!! why we want to make a primitive into an object!!!!! cant we use primitive itself to perform the operations!!!

please clarify me on wrapper classes!!!

what is the use of the wrapper classes!!! why we want to make a primitive into an object!!!!! cant we use primitive itself to perform the operations!!!

please clarify me on wrapper classes!!

In Java you cant call methods on primitives.

Can u give more explanation on it!!!!can you give one example !!!!

E.g String is a class so it has methods like .toLowerCase() etc... .Primitives like char or int dont support this.

import java.util.Scanner;
class ScanNext {
public static void main(String [] args) {
boolean b2, b;

int i;
String s, hits = " ";
Scanner s1 = new Scanner(args[0]);
Scanner s2 = new Scanner(args[0]);
while(b = s1.hasNext()) {
s = s1.next(); hits += "s";
}
while(b = s2.hasNext()) {
if (s2.hasNextInt()) {
i = s2.nextInt(); hits += "i";
} else if (s2.hasNextBoolean()) {
b2 = s2.nextBoolean(); hits += "b";
} else {
s2.next(); hits += "s2";
}
}
System.out.println("hits " + hits);
}
}

If this program is invoked with
% java ScanNext "1 true 34 hi"

it produces
hits ssssibis2


can u give explanation for this program!!!! how output has come like ssssibis2

ques1)why String class is marked as final?

ques2)whats the use of making String as immutable?

What is serialization ?? can u give a good example to explain it?