Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Thayanithy
java do wile
1 Answer(s)      6 years and 2 months ago
Posted in : Java Server Faces Questions



Advertisement
View Answers

November 18, 2008 at 12:10 AM


Hi friend,


Code to solve the problem :

import java.io.*;
import java.util.*;
import java.sql.*;

class WordString
{
public static void main(String[] args) throws Exception
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader bufReader = new BufferedReader(isr);

System.out.println("Enter two Words");

System.out.println("Enter First Word");
String wordFirst = bufReader.readLine();
System.out.println("Enter Second Word");
String wordSecond = bufReader.readLine();
int worldLen = wordFirst.length() + wordSecond.length() ;
int strlen = 40-worldLen;

String str="";
if(strlen>1)
{
for(int i=0;i<strlen;i++)
{
str+=".";
}
}
else
{
str=".";
}

String wordString = wordFirst +str+wordSecond;
System.out.println(wordString);

}
}

For more information on java visit to :

http://www.roseindia.net/java/

Thanks


Related Tutorials/Questions & Answers:
java do wile - Java Server Faces Questions
java do wile  Write a program that asks the user to enter two words. The program then prints out both words on one line. The words will be separated by dots so that the total line length is 40. If your first word was turtle
Use if, if else,for,while,do wile ad switch in same Java Class
Use if, if else,for,while,do wile ad switch in same Java Class  hi how to use if, if else,for,while,do wile ad switch in same class? very urgent... "); System.out.println("5. Exit"); boolean quit = false; do{ System.out.print("Please
Advertisements
Do needful - Java Beginners
Do needful  Hai how can I do the string to Hex in java. Pls help me  use conversion concept  Hi friend, import java.io.*; import java.io.IOException.*; public class StringToHexa{ public static void
Dont Do this - Java Beginners
Dont Do this  Whenever you guys ask a question please describe your query? Otherwise you lost your time and other who are given answer to you. thanks Rajanikant
How do I do this program? I'm new to Java programming...
How do I do this program? I'm new to Java programming...  Suppose you want to print out numbers in brackets, formatted as follows: [1] [2] [3] and so on. Write a method that takes two parameters: howMany and lineLength
How do i do the coding for 'leaving a comment' in java
How do i do the coding for 'leaving a comment' in java  i am designing a webpage.In my webpage i want to add the option of adding a comment by the readers of the page.how do i do
Do-while loop in Java
Do-while loop in Java In this section you will learn about do-while loop in Java. do-while loop is similar to while loop but the difference is do-while loop... condition repeatedly and run at least once. For that we need a do-while loop so
do-while Loop in Java
do-while Loop in Java       In some conditions in java, you need to run some statements and processes once at least. For that you have to use the do while loop in  after
How do I compare strings in Java?
How do I compare strings in Java?  How do I compare strings in Java
How do I decompile Java class files?
How do I decompile Java class files?  How do I decompile Java class files
How do I initialize a byte array in Java?
How do I initialize a byte array in Java?  How do I initialize a byte array in Java
what is java and why do i need it?
what is java and why do i need it?  Hi, Please tell me what is Java and why do i need it? Is it free to download? Also explain me how to write and test my first Java Application? What is the configuration or system requirement
how to do combinations in java - Java Beginners
how to do combinations in java  i have 2 arrayLists. i want do...()); } } } For more information on Java.util Package visit to : http://www.roseindia.net/java/example/java/util/ Thanks
how do you parse by reference in java(with JGrasp)
how do you parse by reference in java(with JGrasp)  i am a 1st year beginner in java programming(GR 10) at hillcrest High School in south Africa My question is how do you parse by reference in java(with JGrasp) please help me i
HOW TO DO WEBSITE INTERFACE FOR JAVA MODULE
HOW TO DO WEBSITE INTERFACE FOR JAVA MODULE  Hi , Greetings. I have created modules in java separately , example student registration , view... , student regis. modules is displayed and so on. What need to do to create
What do you understand by Hibernate in Java?
What do you understand by Hibernate in Java?  Hey, do you know about Hibernate in Java? I have to learn it for my next project. What is the best... for the any Java based project? Thanks   Since you have assign
how do i write a java program for this??
how do i write a java program for this??  ‚??Ask the user if they have a dog. If ‚??yes‚??, ask the user how old is and compute the dog‚??s age in human years. Display the output. If ‚??no‚?? ask the user their age and compute
what should i do next?? - Java Beginners
what should i do next??  I know java basics.actully i passed the SCJP exam.Then now i have no idea about what should i do next.I like to come... are in Hyderabad go for satya technologies for further java course(Servlets,jsp,EJB
how to do an measure converter in netbeans - Java Beginners
how to do an measure converter in netbeans   hi im not sure... information on joptionpane visit to : http://www.roseindia.net/java/java-tips/GUI/containers/20dialogs/10joptionpane.shtml http://www.roseindia.net/java/java-tips
do this for me plzz - Java Interview Questions
do this for me plzz  Given the no of days and start day of a month... to print in the same line i.e., without printing a newline. 2)You do...: http://www.roseindia.net/java/ Thanks. Amardeep
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
Java web development, what skills do I need?
Java web development, what skills do I need?  Java web development, what skills do I need
How do I write a correct micro-benchmark in Java?
How do I write a correct micro-benchmark in Java?  How do I write a correct micro-benchmark in Java
How do I set environment variables from Java?
How do I set environment variables from Java?  How do I set environment variables from Java
How do you map Java Objects with Database tables?
How do you map Java Objects with Database tables?  Hi, How do you map Java Objects with Database tables? thanks
Do While Loop in Java
Do while loop in Java There are three loops most commonly used in Java e.g..... Do while loop is java is slightly different with While loop as in While loop... for the do-while loop: do { statements; } while(condition
How do I handle the reaction of a circle and a semi-circle colliding in java?
How do I handle the reaction of a circle and a semi-circle colliding in java?  How do I handle the reaction of a circle and a semi-circle colliding in java
How do i create the node for target SMO in java..???
How do i create the node for target SMO in java..???  How do i create the node for target SMO in java..??? or else whats the method for accessing the target SMO
How do i start to create Download Manager in Java - JSP-Servlet
How do i start to create Download Manager in Java  Can you tell me from where do i start to develop Download manager in java
How to do Null validation for a boolean variable - Java Beginners
How to do Null validation for a boolean variable  How to do Null validation for a boolean variable in JAVA?  Hi friend, For solving the problem visit to : http://www.roseindia.net/java/master-java/variables
I really need a tutor for Java program that has to do with multithreading and gui!
I really need a tutor for Java program that has to do with multithreading and gui!  I am looking for a Tutor to help me with a Java program, specially GUI and multithreading. If you can tutor, please email me
Advertisements
 

 

 

DMCA.com