- 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
Java String Concatenation with Other Data Types.
If you try to concatenate strings using concat() method, you can concat variables of string data type only.
To concatenate strings with other data type you need to use the ‘+’ operator.
Example
public class Test { public static void main(String args[]){ String st1 = "Hello"; int data = 230; String res = st1+data; System.out.println(res); } }
Output
Hello230
Advertisements