Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java Programming for Beginners

You're reading from   Java Programming for Beginners Learn the fundamentals of programming with Java

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781788296298
Length 318 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
SkillSprints Inc., Mark Lassoff SkillSprints Inc., Mark Lassoff
Author Profile Icon SkillSprints Inc., Mark Lassoff
SkillSprints Inc., Mark Lassoff
Arrow right icon
View More author details
Toc

String functionality

Working with strings in Java can be a little confusing at first because they really are a special case. Strings have associated with them this concept of a string literal, that is, a sequence of characters between double quotation marks. We can just put it right into our Java programs and Java will understand it, just like it would understand an integer number or a single character.

Unlike integers, characters, and floats, Java doesn't have a primitive keyword associated with this string literal. About the closest we could get if we wanted to is a character array; however, generally, Java likes us to associate string literals with the String class. To understand the String class better, look at the following program:

package strings; 
 
public class Strings { 
 
    public static void main(String[] args) { 
        String s1 = new String
(&quot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image