- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34489 Articles for Programming
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/13521/profile/60_79767-1512650417.jpg)
101 Views
Since String class is immutable once created we cannot modify the data of the string. But still, if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.Examplepublic class Test { public static void main(String args[]) { String str = "Hi welcome "; StringBuffer sb= new StringBuffer(str); sb.append("to Tutorialspoint"); System.out.println(sb); } }OutputHi welcome to Tutorialspoint
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/13526/profile/60_48621-1512703980.jpg)
3K+ Views
You can reverse the contents of a given String using leaving the spaces using the reverse() method of the StringBuffer class.Examplepublic class Test { public static void main(String args[]) { String str = "hi welcome to Tutorialspoint"; String strArray[] = str.split(" "); StringBuffer sb= new StringBuffer(str); sb.reverse(); for(int i=0 ; i
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
131 Views
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant, their values cannot be changed after they are created. To learn more about Strings visit Tutorialspoint Strings page.
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/13523/profile/60_83090-1512649277.jpg)
2K+ Views
The StringBuffer class contains a method known as deleteCharAt(). This method deletes the character at a specified index/position. You can use this method to delete/remove a particular character from a string in Java.Examplepublic class Test { public static void main(String args[]){ String str = "hi welcome to Tutorialspoint"; StringBuffer sb= new StringBuffer(str); sb.deleteCharAt(sb.length()-1); System.out.println(sb); } }Outputhi welcome to Tutorialspoint
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/13510/profile/60_55588-1512537391.jpg)
16K+ Views
Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects.The Java platform provides the String class to create and manipulate strings.The most direct way to create a string is to write −String greeting = "Hello world!";Whenever it encounters a string literal in your code, the compiler creates a String object with its value in this case, "Hello world!'.ExampleLive Demopublic class StringDemo { public static void main(String args[]) { char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' }; String helloString ... Read More
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/15002/profile/60_183575-1514465925.jpg)
282 Views
The keys() method of Python dictionary class returns a view object consisting of keys used in the dictionary.>>> d1 = {'name': 'Ravi', 'age': 21, 'marks': 60, 'course': 'Computer Engg'} >>>d1.keys() dict_keys(['name', 'age', 'marks', 'course'])It can be stored as a list object. If new key-value pair is added, the view object is automatically updated.>>> l1=d1.keys() >>> l1 dict_keys(['name', 'age', 'marks', 'course']) >>>d1.update({"college":"IITB"}) >>> l1 dict_keys(['name', 'age', 'marks', 'course', 'college'])
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/654775/profile/60_3867437-1684125242.jpg)
302 Views
The update method is one of the methods of dictionary data structure. It is used to update the values in the already created dictionary which means it adds a new key value pair to the dictionary. The updated key and value will be updated at the last. The dictionary is represented by curly braces{}.The dictionary contains key and value pairs, combinedly called as items which can accept any data type of elements as values. It is mutable which means once the dictionary is created we can apply the changes. It has key, value pairs separated by colon and the key ... Read More
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/654775/profile/60_3867437-1684125242.jpg)
468 Views
Double quotes are used to represent a string or a character as well as can be used in the print function to print the defined statement as the output. The functionality of the single quotes and double quotes is same. We can use any type quotes as per our requirement. The following is the syntax to create a string using the double quotes in the python programming language. str = “text” Where, “ ” are the double quotations text is the data to be in string format Example Let’s see an example to understand the functionality and ... Read More
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/654775/profile/60_3867437-1684125242.jpg)
808 Views
JSON can be abbreviated as JavaScript Object Notation. It means a script of a text file in a programming language to transfer and store the data. It is supported by the python programming language using a built-in package named json. It’s text is given in the quoted string format which contains a key and value within the curly braces{} which looks like a dictionary. To access a JSON document using python we have to import the json package. In this package we have a method named dumps() which is used to convert the python tuple objects into the Java ... Read More
![Naveen Singh](https://www.tutorialspoint.com/assets/profiles/654775/profile/60_3867437-1684125242.jpg)
24K+ Views
In python there are different types of data structures. Among them list, tuple, dictionary. All these three are used to store the data in the python programming language. What is a List? List is one of the data structures available in python which is used to store multiple values in a single data structure. We can create a list in Python using the square braces[ ]. It is mutable which means that we can modify a list once it is created. It takes multiple elements of different data types such as int, float, str etc which are separated by ... Read More