Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Programming: Initials 1

Write a program that asks for names and displays the initials.

Tutorial Details:

Ask the user for their first name. Save it in a string variable.
Ask the user for their last name. Save it in a string variable.
Use the substring() method to get the first characters from both the first and last names. Use the toUpperCase() method to convert them to upper case.
Display the initials to the user.
Discussion
What you need is the first letter of each name. There are two ways to get it.

substring(...). You can use the substring(...) method to get a one-character substring starting at the beginning of the name. You can then concatenate this to the first letter from the other name.


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/strings/q-pr-string-if/q-pr-initials1.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Programming: Initials 1

View Tutorial:
Programming: Initials 1

Related Tutorials:

Programming Java threads in the real world, Part 9 - JavaWorld June 1999
Programming Java threads in the real world, Part 9 - JavaWorld June 1999
 
Java Tip 81: Jazz up the standard Java fonts - JavaWorld
Java Tip 81: Jazz up the standard Java fonts - JavaWorld
 
Programming XML in Java, Part 1 - JavaWorld March 2000
Programming XML in Java, Part 1 - JavaWorld March 2000
 
Debug with jdb - JavaWorld June 2000
Debug with jdb - JavaWorld June 2000
 
C#: A language alternative or just J--?, Part 2 - JavaWorld December 2000
C#: A language alternative or just J--?, Part 2 - JavaWorld December 2000
 
Web services hits the Java scene, Part 1
Web services hits the Java scene, Part 1
 
J2SE 1.4 premieres Java's assertion capabilities, Part 1
J2SE 1.4 premieres Java's assertion capabilities, Part 1
 
SGLayout—a layout manager for the rest of us
SGLayout—a layout manager for the rest of us
 
Speed up your Swing GUI construction with better building blocks
Speed up your Swing GUI construction with better building blocks
 
Nested Classes, Part 1
Nested Classes, Part 1 The concept of nesting a class within another class or method presents unique issues not found elsewhere in object-oriented programming.
 
FindBugs, Part 1: Improve the quality of your code
FindBugs, Part 1: Improve the quality of your code One of the problems with code quality tools is that they tend to overwhelm developers with problems that aren't really problems -- that is, false positives. When false positives occur, developers learn
 
FindBugs, Part 2: Writing custom detectors
FindBugs, Part 2: Writing custom detectors How to write custom detectors to find application-specific problems In the first article in this series, I showed you how to set up and execute FindBugs. Now we'll take a look at FindBugs' most powerful fea
 
Java Development on Eclipse, Part 1
Java Development on Eclipse, Part 1 Author\'s note: In part one of a two-part series of excerpts from Eclipse\'s Chapter 2, we\'ll get down to the business of developing Java using Eclipse. We\'re going to take a look at using Eclipse for Java developm
 
Classifier4J
Classifier4J is a Java library designed to do text classification. It comes with an implementation of a Bayesian classifier, and now has some other features, including a text summary facility.
 
JFormula 2.9 - Math expression API
JFormula 2.9 - Math expression API JFormula is a Java library for evaluating various expressions (boolean, math, if/then/else...). A lot of companies chose JFormula like EADS Space Transportation.
 
Access Windows Performance Monitor counters from Java, Part 1
Access Windows Performance Monitor counters from Java, Part 1 Use a simple Java API to gather valuable performance statistics Summary Windows NT, 2000, 2003, and XP contain a utility called the Performance Monitor that provides a rich array of perform
 
Sun Repricing Select Sun StorEdge 3000 Arrays
To provide customers with affordable storage products, Sun is reducing its price on the Sun StorEdge 3310 SCSI Array, Sun StorEdge 3510 FC Array, and Sun StorEdge 3511 FC Array with SATA.
 
Buy Fedora Core 3 Test 1 Linux CD's in India.
Buy Fedora Core 3 Test 1 Linux CD's in India. Fedora Core 3 Test 1 Linux Fedora Core 3 Is Available Now Available Fedora Core 3 Test 1CD's We are providing the free downloadable version of Fedora Core 3 Test 1 Linux CDs, which is distributed
 
Buy Xandros 2.01 OCE in India from us.Xandros 2.01 OCE is available in India at cheapest rate.
Buy Xandros 2.01 OCE in India from us.Xandros 2.01 OCE is available in India at cheapest rate. Xandros 2.01 OCE Linux Now Available Linux Xandros 2.01 OCE CD's What is Xandros 2.01 OCE? Xandros Desktop OS Open Circulation Edition (OCE) is a
 
Updated Hardware Certification Test Suite Available for Download
Version 2.4 of the HCTS is now available. Use it to certify your hardware on the Solaris 9 Operating System (and updates) and the Solaris 10 OS, 32-bit and 64-bit environments.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.