line length in java

line length in java

View Answers

March 20, 2009 at 4:46 AM

Hi friend,

Code to help in solving the problem :

import java.io.*;
class StringLength
{
public static void main(String[] args) throws Exception
{

String string = "";
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
// read in user input
System.out.println("Enter the first word");
String str1=reader.readLine();
System.out.println("Enter the second word");
String str2=reader.readLine();
String str3=str1+""+str2;
int len=str3.length();
int dotlen=0;

if(len<=30)
{
dotlen = 30-len;
}
String strdot="";
for(int i=1;i<=dotlen;i++)
{
strdot+=".";
}
System.out.println("Output String : " +str1+strdot+str3);



}
}


Thanks









Related Tutorials/Questions & Answers:
line length in java - Java Beginners
line length in java  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 enough dots so that the total line length is 30  Hi friend
String length without using length() method in java
String length without using length() method in java  How to count length of string without using length() method in java?   Here is Example...) { i++; } System.out.println("String length : " + i
Advertisements
How to get length of string in Java?
How to get length of string in Java?  What is the method of String for getting the length? How to get length of string in Java? Tell me code fast... Tutorials"; int length = str.length(); You have to use the str.length() to get
stream length not specified - Java Beginners
stream length not specified  our requirement is we need to send the audio data that is spoken by the client to the server and save it in a file. when we r using servlet applet technology we r getting stream length not specified
Java : Length of String
Java : Length of String In this tutorial we are going to write logic to count the length of specified String. Length of String : Length of string means the number of characters in your String. There is many way to find out the length
java - read file line by line in Java
java - read file line by line in Java  Hi, how one can read a text file line by line in Java? What is the benefits of reading a file line by line... file in Java can be read line by line with the help of BufferedReader class
Java - How to read a string line per line
Java - How to read a string line per line  Java - How to read... to read the big String line per line? Is there any API available in Java...(System.getProperty("line.separator")); Read more at: Java Read File Line
length() Method In Java
length() Method In Java       In this section, you will learn how to use length() method of the String class. We are going to using length() method. These method
length in array
length in array  wat s length in array
Java Command Line Input
Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line System.out.println("Please Input A Number"); BufferedReader br
java line chart
java line chart  Hi, I want to draw a graphic in java line chart and ? searched the documents ?n the web. I found the example codes ?n your site (http://www.roseindia.net/chartgraphs/xyline-chart.shtml) and tr?ed ?n my
length in array
length in array  hi wat is length in array and where s it used
Java Read File Line by Line - Java Tutorial
Java Read File Line by Line - Example code of reading the text file in Java one line at a time     ... to write java program to read file line by line. We will use the DataInputStream
length in array
length in array  hai wat s length in array and where it s used
How to read big file line by line in java?
Learn how to write a program in java for reading big text file line by line... is very useful in reading big file line by line in Java. In this tutorial we... is complete example of java program that reads big text file line by line
length of etag
length of etag  etag header in http - Does the HTTP protocol specify a max length for the ETag?   No, HTTP protocol do not specify a max length for the ETag
Java Array Length
Java Array Length In this section you will find a program to find the length of array in java. An array is collection of similar data type. To find the length of array is a simple program in java. Using length function you can find
Read file line by line in Java 8
Java 8 Read file - Reading file line by line in Java 8 Today  we will discuss the new API which is added to Java 8 for reading a file line by line..._TO_REPLACE_4 Examples of reading a file line by line in Java 8 Following is example
Java read file line by line - Java Tutorial
C:\nisha>javac ReadFile.java C:\nisha>java... input line by line with an appropriate BufferedReader.ADS_TO_REPLACE_1...;File Line By Line   while ((strLine = 
Write a program in JAVA which accepts a sentence & displays the longest word in the sentence alongn with it length of the word.
Write a program in JAVA which accepts a sentence & displays the longest word in the sentence alongn with it length of the word.  **A program in JAVA... with it length of the word
Line Graphs in java - Java Beginners
Line Graphs in java  Hi... I need to generate a graph by using the database values using java I know about the JFreeChart class... But by using that...I'm unable to display the values in the chart. I'm just getting
How to read a large text file line by line in java?
How to read a large text file line by line in java?  I have been... you kind advice and let's know how to read a large text file line by line in java... of the application and the memory available for the Java program. For Java program max
How to write file by line in Java
How to write file by line in Java  How to write file by line in Java   Hi, For Write to a file by line using java programming language we... in a new line. How to use Write To File By Line in Java programs
How to Read file line by line in Java program
by line in Java. But there are various ways that can help read a larger file... having less amount of memory. In the example of Java Read line by line below... of read file line by line in Java is printed on console.ADS_TO_REPLACE_5
What is command line argument in Java
example of command line argument program in Java?? It will be really helpful... visit the following link: http://www.roseindia.net/java/beginners/cmnd-line...://www.roseindia.net/java/beginners/cmnd-line-arguments.shtml
how to read file line by line using filereader in java
how to read file line by line using filereader in java  Hi, how to read file line by line using filereader in java? Thanks   Hi...))) { String line; while ((line = br.readLine()) != null
Command Line Arguments in Java
Command Line Arguments in Java The ongoing Java application can accept any...-line argument is an argument, which passed at the time of running of the Java... /** * How to use command line arguments in java program. */ class CmndLineArguments
Multi line graph - Java Beginners
Multi line graph  Hi, I want a multi line graph on a single chart using jfree in java.... Can you please let me know the code... thanks... MultiLineChart("Multi Line Chart"); demo.pack
command line arguments - Java Beginners
command line arguments  how can i findout the minimum and maximum no's at the command prompt if i give some values?????????  hi friend, We are providing you a code that will prompt the user to input some numbers
Java Array Length
Java Array Length       In this section, you will learn about the java array length. The java array.... Arrays are always a fixed length abstracted data structure  which can
Java read file line by line
Java read file line by line In this section, you will learn how to read a file line by line. Java has provide several classes for file manipulation. Here we are going to read a file line by line. For reading text from a file it's better
Java write to file line by line
Java write to file line by line In this section, you will learn how to write a file line by line. It is better to use Writer class instead of OutputStream... to a byte array. The method newLine() is used for writing a new line character. We
php array length sizeof
php array length sizeof  php array length sizeof function
php array length function
php array length function  writing a php array length function
Java Read File Line By Line, Video Tutorial of Java Read File Line By Line
a program in Java programming language to read a text file line by line. The "Java Read File Line by line" is most searched topics by the Java developers. This means Java developers are using the Java for reading the file line
Command Line Arguments in Java Program
Command Line Arguments in Java Program   ... command line arguments in java program.    */  ... program with some command line arguments like: java CmndLineArguments
How To Read String From Command Line In Java
How To Read String From Command Line In Java In this section we will discuss about how string can be read through the command line. In Java command line argument is entered when an application is invoking. This command line argument
php array length property
php array length property  How to get the php array length property
php array length for loop
php array length for loop  can i get the php array length using for loop
ModuleNotFoundError: No module named 'length'
ModuleNotFoundError: No module named 'length'  Hi, My Python... 'length' How to remove the ModuleNotFoundError: No module named 'length'... to install padas library. You can install length python with following command
Array length in PHP - PHP
Array length in PHP  a function to get the array length in PHP.  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/php/phparray/php-array-length-for.html Thanks
php array length
php array length  Get length of an array elements
Command line argument in java
Command line argument in java. In this section we are going to discuss about command line argument in java. Command line argument allow a user to pass arguments at the time of running the application , after the class name. Java allow
Get Length of Array
Get Length of Array       In this Tutorial we make a simple example to understand Get Length of Array in Java Script. In this code we import a  package java.util and java
http header content length
http header content length  How to check the request header content length in HTTP
Java Generic program with command line argument
Java Generic program with command line argument  Implement Generic to perform arithmetic evaluation using command line argument by using Java
Draw a line in a JPanel with button click in Java
Draw a line in a JPanel with button click in Java  Draw a line in a JPanel with button click in Java
How to pass command line arguments in Java?
How to pass command line arguments in Java?  Hi, In a Java program I have to write for reading the command line arguments and use it in a programming. How to pass command line arguments in Java? Share me the sample code
Java memory options from command line
Java memory options from command line  Hi, How to use java memory options from command line? Thanks   Hi, Here is the example code: java -Xms1056m -Xmx1056m MyProgram Thanks
Command Line Standard Output In Java
Command Line Standard Output In Java In this section we will discuss about the Command Line Java IO Standard Output. Standard streams, feature of various O/S, are written through standard output in Java. Standard streams can

Ads