473,432 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

why strings in java when we can have array of characeter or viceversa?

why strings in java when we can have array of characeter or viceversa?
Oct 11 '10 #1
2 1212
Ciary
247 Expert 100+
because an array is fixed size, and a string isn't. a string is more an arraylist of chars but appending to an arraylist requires more code than appending 2 strings together.
Oct 11 '10 #2
In Java Strings are immutable, so they technically are a fixed size. They are far more convenient and easier to use than Char[] though. Say you have String s = "hi". You can call any function on s, but as long as you don't break the reference to s you will always be able to see that s = "hi".
Oct 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: ssg31415926 | last post by:
I need to cast a string into an object and vice versa. At the moment, I'm using code like this: int numOfObjects = Values.Length; object objects = new object; for(int i = 0; i < numOfObjects;...
1
by: vinothvadivelan | last post by:
hi people, how can i find the size or number of hashtable entries in a n hash table array. i remember using size() function for a hashtable but its not working for hashtable. why is it...
4
by: Amit Limaye | last post by:
This is wht i want to do typedef struct _notificationdataformat_ { char *m_OID; char **m_OIDList; f1 funcptr; } NOTIFICATIONDATAFORMAT; NOTIFICATIONFORMAT...
2
by: Krann | last post by:
Hi all: I am new here as in C. I want to store some strings in an array and i did, but when I show in the screen only shows me the last string i introduce, here is my C source code: #include...
4
by: ankurmaheshwari | last post by:
hii all How to make 2-d array in java when no of rows are not known let me know if u have the solution 4 it... Regards ankur maheshwari
14
by: cat_dog_ass | last post by:
....Microsoft ports the .NET framework to other operating systems? Will the only advantage that Java has over .NET be lost? I've been a Java programmer and will be shifting to .NET soon. Is this...
9
by: nerd19 | last post by:
I was wonder how i would go about limiting a length of a string that is going to be entered into a text box. An example my explain this better: the data is coming from a barcode that reads: ...
4
praclarush
by: praclarush | last post by:
Hey everyone, I’m new at Java and I’m having a bit of trouble. I have an assignment in which I have an Array of objects. The user is to input a name, which then needs to be found in the Array so that...
0
by: r035198x | last post by:
Inheritance We have already covered one important concept of object-oriented programming, namely encapsulation, in the previous article. These articles are not articles on object oriented...
2
pradeepjain
by: pradeepjain | last post by:
hii,for some reasons i am using java instead of php.i need to use php within java code..is it possible.
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.