Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

How can I improve the pig latin translator java?

Asked by Sam Shukla Oct 14, 2022 1.1K views 1 answer
Share

About this question

 Over the last few days I created this Pig Latin Translator just for fun. I would really appreciate it if anybody could give suggestions of how to improve the code and make the program more efficient. Here is the GitHub link for the project The code is in PigLatin.java.

/* -------------------- Program Information -------------------- Name Of Program: PigLatin.java Date of Creation: 7/3/2018 Name of Author(s): Agnik Banerjee Version of Java: 1.8.0_171 Created with: IntelliJ IDEA 2017.3.5 Community Edition -------------------- Program Information -------------------- */ import java.util.Scanner; public class PigLatin { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { System.out.print("Enter one or more words that you would like to translate to Pig Latin: "); final String userInput = scan.nextLine(); scan.close(); String[] word = userInput.split(" "); // Splits the string into an array of words String output = ""; for (int i = 0; i < word xss=removed xss=removed xss=removed xss=removed>

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.