Home Answers Viewqa Java-Beginners line length in java

 
 


Abhishek Sisodia
line length in java
1 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners

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 Pages:
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 example
String length example       In this section, you will learn how to get the length of given string. The lang package of java provides the facility for getting
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
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
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
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
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
Passing Command Line Arguments
Passing Command Line Arguments     ... pass values on command line argument . We are taking a sequence of character from command line at run time. Store these strings into an array
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 - 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
JSP Array Length
JSP Array Length          JSP Array Length is performed when you want to compute the length of array in JSP. Understand with Example The Tutorial
JavaScript array length function
JavaScript array length function In this Tutorial we want to describe you a code that help you in understanding JavaScript array length function. We... by line breaker. The for loop execute and run the script till var i is less than
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 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
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
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
How to Read a file line by line using BufferedReader?
How to Read a file line by line using BufferedReader?  Hello Java... at a time very efficiently. View the detailed example and code at Java Read File Line by Line - Java Tutorial page. Thanks
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
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
JavaScript array length function
JavaScript array length function   ... you in understanding JavaScript array length function. We are using .... The document. write print the 'Element of the array' followed by line breaker
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 Read File Line by Line - Java Tutorial
Java Read File Line by Line - Java Tutorial       In the section of Java Tutorial you will learn how to write java program to read file line by line. We
Get Length of Array
Get Length of Array      ... in  get a length of array. For this we are using JavaScript language... to specify the delimiter that enables you a break line after each number separately
Line Animation in Java
Line Animation in Java       In this example we are creating an animated line. The color of  line is changing alternatively. We use drawLine() to draw a line
Line Drawing - Swing AWT
Line Drawing  How to Draw Line using Java Swings in Graph chart,by giving x & Y axis values  Hi friend, i am sending code of draw line...) { System.out.println("Line draw example using java Swing"); JFrame frame = new
Compiling package in command line
to java programming, i am basic learner in java. My query is, How to compile java package using command line. For Eg: When i compile following command, c:>set... how to compile it. Thanks & Regards, Sham   Compiling Java
COMMAND LINE ARGUMENTS
COMMAND LINE ARGUMENTS  JAVA PROGRAM TO ACCEPT 5 COMMAND LINE ARGUMENTS AND FIND THE SUM OF THAT FIVE.ALSO FIND OUT LARGEST AMONG THAT 5   Hi Friend, Try the following code: import java.util.*; class
Line Number Reader Example
:\convert\rajesh\completed>java LineNumberReaderExample Line: 1: import java.io.... Line Number Reader Example      ...; readLine() method is used to read the data line by line. LineNumberReader
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
JBoss Unix and Line Separator
JBoss Unix and Line Separator  Hi, I am trying to solve an critical problem. I have an application which write a batch file using the method println from the PrintWriter class from java api, this method uses the default line
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()) 
String Length
String Length          In java, Strings are objects that belong to class... things with the string object like we can find out its length, we can compare
Java Write To File By Line
Java Write To File By Line In this tutorial you will learn how to write to file by line Write to a file by line using java you can use the newLine() method of BufferedWriter class. newLine() method breaks the continuous line
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 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 - 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 file line reader
Java file line reader In this section, you will learn how to read a particular line from file. Sometimes you want to read a particular line from the file... and parse the file path. Through the code, we want to read the line 3 of the file
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
how to write to file at the end of the line
how to write to file at the end of the line using Java program. Plz suggest... found a good reference website for Java programming. I hope this reference website will help you for "How to write the file at the end of line using Java language
java write to a specific line
java write to a specific line In this tutorial, you will learn how to write at specific line in text file. Java provides java.io package to perform file operations. Here, we are going to write the text to the specific line of the text
length in array
length in array  wat s length in array
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
Java file new line
Java file new line In this section, you will learn how to write the text in new line of text file. Description of code: The package java.io.* has provide..., BufferedWriter has provide a method newLine() which writes the text into another line. You
Multi-line cells in the JTable - Java Tutorials
Multi-line cells in the JTable 2002-04-11 The Java Specialists' Newsletter [Issue 045] - Multi-line cells in the JTable Author: Dr. Heinz M. Kabutz... any more time, let's look at a real-life Java problem... Multi-line cells
length in array
length in array  hi wat is length in array and where s it used
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 arguments
Java application can accept any number of arguments directly from the command line. The user can enter command-line arguments when invoking the application. When running the java program from java command, the arguments are provided
length in array
length in array  hai wat s length in array and where it s used

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.