Nice to meet you. In new employee training, I learned that when using the Java substring () method, the index number is assigned after the first character of the string is number 0. Is that a string an array of characters?
If i write in C
char salut [20] = "Hello World!";
char ciao [20] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘’,
‘W’, ‘o’, ‘r’, ‘l’, ‘d’, ‘!’};
Can the two variables salut and ciao be essentially the same in this case?
-
Answer # 1
-
Answer # 2
In the C language, there is no type called string.
I just call the zero-terminated character array for convenience. -
Answer # 3
I learned that when using Java's substring () method, the index number is assigned after the first character of the string is 0th.
String
Thesubstring ()
class'ssubstring ()
method is simply expressed as an "index" in the explanation. is not it. It is not intended to be an array.
And when referring to the middle part where the characters are lined up, the "what character" that human thinks is usually called "first character" in the case of the first character, for example.String
method of the/code>class, the first character must be "0th character", so the first character is also intended to be specified in the argument Please understand that sometimes you have to specifysubstring () 0
.
Related articles
- [java] code that shuffles a character string does not work if it has more than 11 characters
- java - i get an error when using an array when instantiating
- [java] handling of array elements and null
- [java] i want to insert a specified character string in the input part on the console
- java - about array code
- java - i want to display the characters entered in edittext in the same way even when the application is closed
- java - about types such as string int
- pass by value of java array variable
- java - i want to output multiple characters at the same time with the println statement
- java - i want to avoid garbled characters that occur in vscode
- java - the content of the string type variable becomes null
- java - an error occurs in the element part of the array and it does not resolve
- java - processing to add and return the characters entered in the array
- shift any number of characters in an array
- java - the garbled characters in the jsp file are not fixed
- javascript - when i try to insert an array string as a class, it becomes undefined
- laravel - if you put an argument in withoutglobalscopes (), "withoutglobalscopes () must be of the type array or null, stri
- java - how to read a string
- get the class of java array
- java - rotate character string to the right, rotate left: the expression to rotate the given string abc by 1 for rotation to the
- java : Is it possible to rely on sqrt when dealing with integers
- java - how to shuffle a graphic array and store it in another array
- java - how to make programming aware of memory and cpu resources?
- i can't think of a way to create a program below the average or i don't understand
- c - i'm sorry for a similar question program of average value using while statement
- character string using an array in c language (including for statement)
- java - i don't know how to extract instance information directly from an array
- java - description when using an array for the return value
- java - please tell me an example of an app made with low code
- java - about arraylist of 2d array
In C languageYes, Java strings are
String
objects, notarrays. It is just a convenience to make it easy to access each character.ciao
has no end'\ 0'
.