Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials


 

 

Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Java Beginners String Array

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

22 comments so far (post your own) View All Comments Latest 10 Comments:

your java is very best in my life i must say you you are the one and only java
progarmmer

Posted by anwar on Wednesday, 10.13.10 @ 15:50pm | #100251

sir,

I need some document from your site,

thanks
vinay

Posted by vinay on Tuesday, 08.31.10 @ 14:55pm | #99284

using string we create a root wise tree

Posted by sunil on Wednesday, 03.24.10 @ 10:36am | #95805

I need help writing this code. write a program using the concepts of Java that weíve seen thus far in class. Save your file (the file with the .java extension) in Project 2 dropbox in the eCompanion.1. Create a class called MyFirstVariables.2. In the main method, create a Scanner object to read input from the keyboard3. Create 3 variables a. One of type int b. One of type double c. One of type String4. Give the variables appropriate names: the int will represent a personís age, the double will represent the personís salary, and the String will represent the personís full name.5. prompt the user to enter his/her age6. get that value and store it in the int variable7. prompt the user to enter his/her salary8. get that value and store it in the double variable9. prompt the user to enter his/her full name10. get that value and store it in the String variable11. Write 3 print statements the print out each variable. An example of one the print statements should look like: Your age is 28. (use the \n escape character to add additional white space between the printed lines)12. Use the increment operator to add one to the personís age.13. Increase the personís salary by 10% using a compound assignment operator.14. Write 2 print statements that print out the new age and salary.15. Write a print statement that only prints the first character of the personís name. The print statement should be something like: The first letter in your name is S

Posted by atuanya hayward on Tuesday, 09.1.09 @ 01:28am | #90470

i got ur code
me satisfied

Posted by vivek on Tuesday, 08.11.09 @ 15:38pm | #89943

that is a great website to show me what i want to know i hope this will be updated to be appreciated my demand.

Posted by phearakrin on Monday, 08.10.09 @ 08:44am | #89896

can u plz explain that whu is the array declared as static and used before main() ??


we would get the same result if we wrote:
class StringCharacter
{

public static void main(String args[]){
String[] roseindia={"chanan","tapan","Amar","santosh","deepak"};
for(int i=0;i<5;i++){
System.out.println(roseindia[i]);
}
}
}

Posted by pranay on Wednesday, 06.24.09 @ 16:12pm | #88769

if i have input like this
1: programing
10: java
2:language

how can i sort them based on the integers in it

Posted by sunil on Wednesday, 03.11.09 @ 11:21am | #85744

helo can you send me a code that the output is when you enter a 5 numbers it will determine the highest and the lowest and it will ask the user on how many numbers did the user want to input and if the user want to try again it will apear their would you like to try again thanks for sonding the code

Posted by henry gallardo on Wednesday, 03.11.09 @ 04:34am | #85733

helo how can i input a code that the output is to look for the name of the presedent where there is a location and the number of the house using the array in java.. thank for sending the code more power.hehehheheheh

Posted by henry gallardo on Wednesday, 03.11.09 @ 04:23am | #85731

Wew!!! tnx 4 having dis program it help us to accomplish our assignments........

Posted by JAckielou Arselo on Monday, 03.9.09 @ 04:05am | #85635

for(int i=0;i<5;i++)..

What if the array size is not known initially?

Posted by amit on Thursday, 03.5.09 @ 05:22am | #85512

hi
my question is if we have agoup of students with their scores..we need to rank them in decreasing order of their score.the output should be the list of students (along with their scores )in that order.
am watting for ur replay
thank u

Posted by Amal on Tuesday, 02.24.09 @ 07:58am | #85166

hi..., how can i make a square magic, plus magic, and cross magic using array?? thnx... gud day..

Posted by gladys ko on Tuesday, 01.27.09 @ 01:31am | #84198

sir,
how ican make a program that will output the ff;
1,2,4,8,16,32

Posted by jane rose a. epa on Wednesday, 01.14.09 @ 03:57am | #83808

how can i make a program that ask the user to input integers, then evaluate it and say whether the array is a series of two or more adjacent elements of the same value....

example:
input : 1 1 2 2 3
output: 2

tnx...

Posted by ree on Sunday, 11.30.08 @ 05:58am | #82194

how can ż add and remove an item into/from a string array? ż couldnt find this. the program is here. please help me. thanks by

import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;


public class Pnng extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
String ips[]={"192.168.1.1","192.168.1.3","10.1.1.99","10.1.1.101","10.1.1.110",
"10.1.1.1","10.1.1.2","10.1.1.25","10.1.1.30","10.1.1.28","10.1.1.43",
"10.1.1.49","10.1.1.27","10.1.1.29","10.1.1.40","10.1.1.45","10.1.1.47",
"10.1.1.90","10.1.1.50"};
boolean reachable = false;
JTextArea ta = new JTextArea(20,20);
JTextField tf = new JTextField(9);
public static void main(String []args){
Pnng win = new Pnng();
win.setTitle("Pinger");
}
Pnng(){
JPanel content = new JPanel();
content.setLayout(new FlowLayout());
//JComboBox cb = new JComboBox(ips);
JScrollPane sp = new JScrollPane(ta);
JButton pingbtn = new JButton("Ping");
pingbtn.addActionListener(new pingbtnBtnListener());
JButton clrbtn = new JButton("Clear");
clrbtn.addActionListener(new clrbtnBtnListener());
JButton addbtn = new JButton("Add Ip");
addbtn.addActionListener(new addbtnBtnListener());
JButton removebtn = new JButton("Remove");

removebtn.addActionListener(new removebtnBtnListener());
//content.add(cb);
content.add(sp);
content.add(pingbtn);
content.add(clrbtn);
content.add(addbtn);
content.add(removebtn);
content.add(tf);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new GridLayout(1,2));
mainPanel.add(content);
setContentPane(mainPanel);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class addbtnBtnListener implements ActionListener{
public void actionPerformed(ActionEvent arg0){
for(int j=0;j<ips.length;j++)
ips.(tf.getText());
}
}
class removebtnBtnListener implements ActionListener{
public void actionPerformed(ActionEvent arg0){
String sonuncu =ips.pop();
}
}
class clrbtnBtnListener implements ActionListener{
public void actionPerformed(ActionEvent arg0){
ta.setText("");
}
}
class pingbtnBtnListener implements ActionListener{
public void actionPerformed(ActionEvent arg0){
for(int i=0;i<ips.length;i++)
{
ta.append("IP Adress: "+ips[i]+" "+"\n");
try
{
reachable = windows_ping(ips[i]);
}
catch(Exception e)
{
e.printStackTrace();

}
if(reachable)
ta.append("reachable...!!!"+"\n\n");
else
ta.append("unreachable...!!!"+"\n\n");

}
}
public boolean windows_ping(String ip) throws Exception {
Process p = Runtime.getRuntime().exec("ping -n 1 -w 100 -l 8 " + ip);
int status = p.waitFor();
return status==0?true:false;
}
}
}

Posted by Mehmet on Thursday, 07.10.08 @ 19:52pm | #66575

hi,
how can i declare sentence "remove this" as array,then read array[0]=remove and array[1]=this

Posted by dee on Wednesday, 12.12.07 @ 16:30pm | #41944

Sir,
Can U Give Me An Example on Dynamically Initalizing The Arrays i.e., By Reading Using System.in.read()

Posted by Praneeth Kumar on Wednesday, 12.5.07 @ 10:49am | #41332

how to declare an array?

Posted by raze on Friday, 11.9.07 @ 08:06am | #36782

Hi Anand,

Thanks for your comments. We have just tested the application and found the output in the following format:

C:\>java StringCharacter
chanan
tapan
Amar
santosh
deepak

You are right the values in the array will be printed in the sequence it was added.

Thanks for your comment.

Posted by Deepak Kumar on Monday, 05.21.07 @ 18:06pm | #16920

class StringCharacter
{
static String[] roseindia={"chanan","tapan","Amar","santosh","deepak"};
public static void main(String args[]){
for(int i=0;i<5;i++){
System.out.println(roseindia[i]);
}
}
}
Output of program:

C:\amar work>javac StringCharacter.java

C:\amar work>java StringCharacter
chandan
Amar
tapan
santosh
deepak

C:\amar work>
My question: Now i want to know that how amar has been chosen between them for treatment?

Posted by Anand Kumar Singh on Monday, 05.21.07 @ 17:22pm | #16918

Ask programming questions?

 

 

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name

 

 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.