Login Register
Code2night
  • Home
  • Blog Archive
  • Tutorial
  • Interview Q&A
  • Languages
    • Angular
    • C
    • c#
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • Security
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
    • Word Counter
    • Base64 Encode/Decode
    • Diff Checker
    • JSON to CSV
    • Password Generator
    • SEO Analyzer
    • Background Remover
  1. Home
  2. Blog
  3. Mastering Strings in Java: Detailed Functions Explained with Examples

Mastering Strings in Java: Detailed Functions Explained with Examples

Date- Dec 09,2023

2798

java strings

String:-

It is a collection of characters or a character-type array.

char a[30];

In any string, we can assign a maximum of (n-1) characters because the nth character will always be null.

How to initialize  a String:-

Char a[30]="Welcome";

I/O function of String:

1. Scanf():- is a formatted function used to input every type of data, including strings.

char a[30];

scanf("%s",&a);

In scanf(), when it reads the blank space, String will automatically terminate.

2. gets(): An unformatted function used to input only string data, including blank spaces.

char a[50];

gets(a);

3. Printf():- formatted function used to print any type of data.

printf("%s",a);


4. puts(): an unformatted function used to print only string data, always from a new line.

puts(a);


                          


S
Shubham Saini
Programming author at Code2Night โ€” sharing tutorials on ASP.NET, C#, and more.
View all posts โ†’

Related Articles

Understanding Abstraction in Java: A Complete Guide with Examples
Dec 09, 2023
Default constructor in java
Sep 07, 2023
User-defined data types in java
Sep 05, 2023
Linked List In Java
Jul 16, 2023
Previous in Java
Essential Java Fundamentals: Step-by-Step Guide to Tools
Next in Java
Understanding Java Memory Management and Garbage Collection

Comments

Contents

๐ŸŽฏ

Interview Prep

Ace your Java interview with curated Q&As for all levels.

View Java Interview Q&As

More in Java

  • Master Java Type Casting: The Complete Guide with Examples 6180 views
  • How to Import java.util.List in Eclipse: Step-by-Step Guide 5787 views
  • org.openqa.selenium.SessionNotCreatedException: session not … 5738 views
  • java.lang.IllegalStateException: The driver executable does … 5064 views
  • Java Program to Display Fibonacci Series 4901 views
View all Java posts โ†’

Tags

AspNet C# programming AspNet MVC c programming AspNet Core C software development tutorial MVC memory management Paypal coding coding best practices data structures programming tutorial tutorials object oriented programming Slick Slider StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blog Archive
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
  • SEO Analyzer
Free Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Diff Checker
  • Base64 Encode/Decode
  • Word Counter
  • SEO Analyzer
By Language
  • Angular
  • C
  • c#
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • Security
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ยท  Terms
Translate Page
We use cookies to improve your experience and analyze site traffic. By clicking Accept, you consent to our use of cookies. Privacy Policy