java pig latin

Ads

 
 

Share on Google+Share on Google+

mike o'connor
java pig latin
1 Answer(s)      6 years and 11 months ago
Posted in : Java Beginners

how do you add the first letter of a word to the end of the word

Ads
View Answers

November 19, 2010 at 11:42 AM


Hi Friend,

If you want to remove the first letter of your word and add it at the end of the same word,try the following code:

import java.util.*;

class Word{
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Word: ");
        String word = input.next();
        char ch=word.charAt(0);
        String st=word.replace(Character.toString(ch),"");
        String newWord=st+Character.toString(ch);
        System.out.println(newWord);
    }
}

And if you simply want to add the first letter of word to the end of same word without removing the letter, then try the following:

import java.util.*;

class Word{
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Word: ");
        String word = input.next();
        char ch=word.charAt(0);
        String newWord=word+Character.toString(ch);
        System.out.println(newWord);
    }
}

Thanks


Ads









Related Tutorials/Questions & Answers:
java pig latin
java pig latin  how do you add the first letter of a word to the end of the word   Hi Friend, If you want to remove the first letter of your word and add it at the end of the same word,try the following code: import
Big Data Pig - Apache Pig
Ecoystem and it provides Pig Latin a textual language for running query against Hadoop...Big Data Pig - Apache Pig  Hi, What is Ping in Big Data? I have heard about Apache Pig. What is Apache Pig? Thanks   Hi, Both
Advertisements
Version of com.intentmedia>pig-annotations dependency
List of Version of com.intentmedia>pig-annotations dependency
Maven Dependency pig-annotations >> 0.0.2
You should include the dependency code given in this page to add Maven Dependency of com.intentmedia >> pig-annotations version0.0.2 in your project
Java Word Processor
reads the same forwards as backwards) ? return a Pig Latin version of the text... this method do its work. To convert a word to Pig Latin: o if the word begins... not be included in the middle of a Pig Latin version of a word but should
what is a indentifier - Java Beginners
) returns true. The Java letters include uppercase and lowercase ASCII Latin letters... is the definition?  An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. An identifier cannot
Java program - Java Beginners
Java program  Dear maam/Sir, I am a 2nd year Computer... not that familiar with java environment.. My friend told me that you can help me with my...{ if ((x == 2) || (x == -10)){ chineseSign="Pig
java
java  diff bt core java and java
java
java  what is java
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
Java
Java  how to do java in command prompt
java
java  why to set classpath in java
java
java  Write a java code to print "ABABBABCABABBA
java
java  how use java method
java
java  why multiple inheritance is not possible in java
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
java
java  Does java allows multiline comments
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java

Ads

 
Advertisement null

Ads