Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    Hey! , so first of all Im very new to JAVA(or programming overall) and I do not study or work with programming, Trying to learn this is just a pure hobby for me.

    So , I have an idea I want to test out, I want to print out a word in the console without using the acutall letters that the word contains.
    Example: I want to type out "TEST" in the console, is it possible to do that without using the letters in the code, like.. not just create a string and name it X and then print out the string cause then the letters would still be typed when I assigned the string.

    Thx in advance!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    want to print out a word in the console without using the acutall letters that the word contains.
    Can you explain what you mean? Are you trying to print out the letters as blocks of *s that make the shapes of the letters?

    Or are you talking about using a String variable that holds the String: "test" instead of using a String literal: "test"
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member Chris.Brown.SPE's Avatar
    Join Date
    May 2008
    Location
    Fort Wayne, Indiana
    Posts
    190
    Thanks
    1
    Thanked 31 Times in 31 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    What is the purpose of not typing the word TEST or the letters in it into the source code? Are you just looking for a way to type it in at run time? The only way i can think is to problematically grab the letters using ascii values.
    Writing code is your job, helping you fix and understand it is mine.

    <-- Be sure to thank and REP (Star icon) those who have helped you. They appreciate it!

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    maybe I explained bad sorry, the only ourpose of this is its a fun project for me . I am trying to print out my name without using the letters the name contains, here is some example how I dont wanna do it:
    take "TEST" as example, I do not want to make Strings like x="T" , y="E" , z="S" and then print out x+y+z+t,
    and I dont wanna make a string called x="test" and printout x.

    because in both these examples you can clearly see that I just reassigned the letters to something else.

    The only purpose of this is that the idea occured to me and I thought it could be fun to try to create a word without actually using the letters it needs. I am sorry for my really bad explantations, cause I just started to learn JAVA very recently so its hard to explain proprely.

    I do not even know if this is possible , please let me know if you want me to explain more deeply

  5. #5
    Member Chris.Brown.SPE's Avatar
    Join Date
    May 2008
    Location
    Fort Wayne, Indiana
    Posts
    190
    Thanks
    1
    Thanked 31 Times in 31 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    Look into ascii values for characters. An int value of 65 casted to a char would make an 'A'. Using this method you can use numbers to piece together your string for output.

    Terms to look up: "ascii chart" and "cast int to char". That should get you started.
    Writing code is your job, helping you fix and understand it is mine.

    <-- Be sure to thank and REP (Star icon) those who have helped you. They appreciate it!

  6. #6
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    Quote Originally Posted by Chris.Brown.SPE View Post
    Look into ascii values for characters. An int value of 65 casted to a char would make an 'A'. Using this method you can use numbers to piece together your string for output.

    Terms to look up: "ascii chart" and "cast int to char". That should get you started.
    Thank you! sound like exactly what Iam looking for!

    --- Update ---

    Thank you Chris.brown , that helped me alot Now I am just figuring out how to print it all on the same line instead of writing system.out.print for every letter, but I managed to find the numbers that represent each letter and it turned out good, ty for your help

  7. #7
    Member Chris.Brown.SPE's Avatar
    Join Date
    May 2008
    Location
    Fort Wayne, Indiana
    Posts
    190
    Thanks
    1
    Thanked 31 Times in 31 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    Look up String and/or char concatenation. That's the topic you're looking for.
    Writing code is your job, helping you fix and understand it is mine.

    <-- Be sure to thank and REP (Star icon) those who have helped you. They appreciate it!

  8. #8
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: help with Idea! (Print out a word in the console without using the letters the word contains) I am new to JAVA!

    yep that helped, fixed it all now, ty for the help!

Similar Threads

  1. How to read letters from a word into an array?
    By zhider in forum Java Theory & Questions
    Replies: 4
    Last Post: December 17th, 2012, 02:36 AM
  2. How to print numbers using do while, for loop and if else statement?
    By techlover in forum Loops & Control Statements
    Replies: 1
    Last Post: October 30th, 2012, 02:13 PM
  3. Replies: 5
    Last Post: August 20th, 2012, 01:01 AM
  4. read a file word by word
    By poornima2806 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 23rd, 2012, 03:14 PM
  5. Reading a text file word by word
    By dylanka in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: October 21st, 2011, 02:06 PM