Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

line length in java

Ads

 
 

Share on Google+Share on Google+

Abhishek Sisodia
line length in java
1 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
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

Ads









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
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
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 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
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.... It returns string line. Following is complete example of java program that reads big
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
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
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... command line arguments in java program. */ class CmndLineArguments { public
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
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
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
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... character encoding. Examples of reading a file line by line in Java 8
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 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...()?. The output of read file line by line in Java is printed on console
Java read file line by line - Java Tutorial
C:\nisha>javac ReadFile.java C:\nisha>java... input line by line with an appropriate BufferedReader...;By Line   while ((strLine = br.readLine()) 
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
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
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
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
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
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
Command Line Arguments in Java Program
Command Line Arguments in Java Program       Java application can accept any number of arguments... command line arguments like: java CmndLineArguments Mahendra zero one two
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
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... have compared an integer variable with the length of command line argument
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 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
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