java do wile

java do wile

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

Ads









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
ModuleNotFoundError: No module named 'wile'
ModuleNotFoundError: No module named 'wile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'wile' How to remove the ModuleNotFoundError: No module named 'wile' error
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
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 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
How do I compare strings in Java?
How do I compare strings in Java?  How do I compare strings in Java
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
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 do beginners learn about Java?
How do beginners learn about Java?  Hi, I am beginner in Java and want to Java very fast. Is it possible to learn java fast? How do beginners learn about Java? Thanks   Hi, Beginners can start learning Java
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
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 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 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
How do I set environment variables from Java?
How do I set environment variables from Java?  How do I set environment variables from Java
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 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
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
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
How do I read a large file quickly in Java?
How do I read a large file quickly in Java?  Hi, I my project I have... in 1-2 GB in size. What is the best way to read the file efficiently? How do I read a large file quickly in Java? Thanks   Hi, You can't read the whole
How do I throw a 404 error from within a java servlet?
How do I throw a 404 error from within a java servlet?  How you can write code in Servlet for throwing the httpd error 404? How to add the configuration for handling the not found error in the web.xml file? Thanks   
How do I learn Java programming in one day from zero?
How do I learn Java programming in one day from zero?  Hi, I am total beginner in Java programming checking if anyone can learn Java quickly. Is there any way of really learning Java in one day? How do I learn Java programming
How do I learn Java programming in one day from zero?
How do I learn Java programming in one day from zero?  Hi, I am total beginner in Java programming checking if anyone can learn Java quickly. Is there any way of really learning Java in one day? How do I learn Java programming
when do we get null pointer exception in java
when do we get null pointer exception in java  can anybody explain me abt null pointer exception? like in wt situation do v get NPE? Are these 2 strings same? String str; String str=null
The while and do
While and do-while      ...\xml>java Bonjour Bonjour Bonjour Bonjour Bonjour... that the condition becomes false and the loop terminates. Have a look at do
Using java script do login form having fields with condition.
Using java script do login form having fields with condition.  Need a login form with username, password, phone no, email id, date fields. We should specify the conditions for each field and if we press the submit button
How do I resolve this Java Class not found exception?
How do I resolve this Java Class not found exception?  Hi, Many time new developer faces the Class not found exception. Why it happens and how to resolve this? Thanks   Hi, The main reason of this exception is un

Ads