Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is Ljava.lang.String;@

I have a string array selectCancel with setter and getter methods, which is a checkbox in my form. I am trying to get the checked values and I am getting the above result when I print.

I tried the Arrays.toString() method but it still prints the same.

I then did the following:

String checked = Arrays.toString(Employee.getSelectCancel()); 

I also tried with the Arrays.asList() and Arrays.copyOf()

So, how do I read this string?

like image 583
Srikanth Sridhar Avatar asked Mar 26 '12 07:03

Srikanth Sridhar


People also ask

What does Ljava Lang Object mean?

lang. Object; is the name for Object[]. class , the java. lang. Class representing the class of array of Object .

What is true for Java Lang string?

This method returns true if, and only if, length() is 0. This method returns the index within this string of the last occurrence of the specified character. This method returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.


Video Answer


1 Answers

The method works if you provide an array. The output of

String[] helloWorld = {"Hello", "World"}; System.out.println(helloWorld); System.out.println(Arrays.toString(helloWorld)); 

is

[Ljava.lang.String;@45a877 [Hello, World] 

(the number after @ is almost always different)

Please tell us the return type of Employee.getSelectCancel()

like image 65
Andreas Dolk Avatar answered Oct 19 '22 03:10

Andreas Dolk