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

Android Lint Check for specific project
why am i getting a java.util.ConcurrentModificationException in the advanced for loop?
Java : Lifo Compensation Method
How to test the spring check_token endpoint
How do I run a JAR File without it having to be the active window?
b1 button doesn't work
Connecting Java to MS Access using JCreator
Static and non static methods with the same name in parent class and implementing interface
How to debug this simple socket client-server application?
Connection to dc in telegram api java
Create facebook like menu
Spring Data: How to set GenerationType strategy while working with #Embeddable and #Embedded
Accessing a particular instance of class inside the same class in java
calculating time complexity of merging presorted lists without using extra memory
JSON - show output as <key> : <value> pair [duplicate]
Java Regular Expressions to Validate phone numbers

Categories

HOME
cakephp
client
openstack
mockito
tinymce
comparison
iot
xmpp
google-docs
spring-cloud-stream
react-redux
amortized-analysis
amazon-ecs
umd
fingerprint
serverspec
django-imagekit
primary-key
fancybox-3
apache-cayenne
usergrid
dosgi
connection-string
google-cloud-speech
lucene.net
visual-composer
lcd
vlsi
buildbot
nhapi
opentype
ejabberd-module
saas
delicious-api
flink-streaming
bosh
key-value-observing
galsim
uisplitview
airconsole
cloud-code
simplexml
dartium
space-complexity
event-driven
code-search-engine
unspecified
android-fingerprint-api
bootstrapper
squib
gzipstream
texmaker
powershell-dsc
jvm-languages
turbogears
total-commander
.net-4.6.2
zip4j
errordocument
multipeer-connectivity
rails-routing
paxos
pnotify
return-value
recursive-datastructures
sqlclient
magma
google-perftools
gnome-shell-extensions
word-vba-mac
medium.com
underscore.js-templating
paypal-express
autorest
lttng
tform
pyke
retina
content-length
twirl
myo
appfabric-cache
cisco-ios
sortedlist
system32
truevault
npapi
dd
nstableviewcell
titanium-modules
responsive-slides
starcluster
seaside
viadeo
c18
ccss
jmapviewer
blending
sqlperformance
specification-pattern
itmstransporter
word-processor
propertyeditor
datawindow
postgresql-performance
gcj
subgurim-maps
inotifycollectionchanged
xfbml
lang
visitor-statistic
jquery-ui-droppable
microsoft-virtualization
photoshop-cs4
nerddinner
thread-local-storage
msdev

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App