java


increment character using int in a for loop


Trying to increment a character in a 'while loop'. However I need to increment (starting with 'A') using an int variable.
int userNum = 3;
char userLetter = 0;
userLetter = 'A';
while (userLetter <= userNum) {
System.out.print( userLetter+ " " );
userLetter++
}
Im trying to find the result: A B C
Thank you
Use this simple code to increment.
public class HelloWorld{
public static void main(String []args){
int count=1;
int userNum = 3;
char userLetter = 0;
userLetter = 'A';
while (count <= userNum) {
System.out.print( (char)(userLetter+count));
count++;
}
}
}

Related Links

Validate data in a “Copy All” button from a ComboBox to a List
convert list into JSON Format in spring
Need to check whether a credit card expiry date is valid in java [closed]
How to listen a huge number of IMAP folders of differnet accounts in one thread?
How to organize java classes?
Execute multiple SQL queries simultaneously via multi threading
Filtering on a list
DateFormat format.parse parse exception: Unparseable date
use of javax.servlet package in maven-bundle-plugin
Why static method cannot hide instance method in java
How can change font to JXteeTable for particular row
com.mysql.jdbc.Driver Error when I run the Jar File although that exists in my Build Path
What is the best way to share only the getter methods to client?
postgresql driver not loaded by the OSGI container?
Eclipse E4 RCP global error handling
PayPal Integration with java

Categories

HOME
java
pandas
asp.net-core
layout
stock
hashmap
iot
bookshelf.js
jira
sqlite3
ezpublish
mouse
midi
rascal
quickbooks
commonmark
progressive-web-apps
django-admin
apache-metamodel
reactcsstransitiongroup
zapier
claims-based-identity
internet-explorer-9
brunch
pingfederate
windows-error-reporting
neo4j-spatial
compatibility
vision
tasklet
file-rename
procdump
bcd
google-cloud-endpoints-v2
data-manipulation
hybridauth
mozilla
bower-install
lto
angularjs-factory
elasticsearch-plugin
trim
mesos-chronos
hp-ux
texmaker
http-live-streaming
glew
turbogears
businessworks
promela
tactic
sybase-asa
sqldf
firmata
vmware-tools
fuzzy-search
ptrace
python-3.2
iis-arr
muse
deis
ios9.1
mono-embedding
remobjects
dundas
streambase
facebook-graph-api-v2.4
codeigniter-routing
document-classification
dml
p4java
dealloc
intentservice
floating-point-precision
inbox
quartz-graphics
easy-install
simba
google-email-migration
gdata-api
twrequest
ocx
parametric-equations
uiviewanimation-curve
fireworks
cinema-4d
appender
sudzc
sproutcore-2
routedevent
thunderbird-lightning
mtj

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App