javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What errors do you get and at which lines. Post the errors you get.

Also if it runs what results do you get what you were expecting?

Also the tab character is this:
\t

System.out.println("aaa\tbbbbb")

and for new line:
\n
System.out.println("aaa\nbbbbb")

Try running the above just for testing

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to count how many elements are inserted and when you reach 10 exit.

If I understood correctly you will need this:

int count = 0;

do {
System.out.print("Enter 1 for F to C, 2 for C to F, and 3 to quit");
choice = input.nextInt();
if (choice == 1) {
count++;
tempC();
} else if (choice == 2) {
count++;
tempF();
} else if (choice == 3) {
exit();
} else {
System.out.println("Invalid selection");
}
if (count==10) {
  choice = 3;
}
} while (choice != 3);
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Assuming that I understood correctly and you need to know the type of your variable.

Then if it is an Object try this:

String obj = "asd";

        System.out.println(obj);
        System.out.println(obj.getClass());
        System.out.println(obj.getClass().getName());

It will print:

asd
class java.lang.String
java.lang.String

If it is a primitive type, I have tried this and it worked. It converts the primitive type to its object type:

int i = 0;
        Object obj = i;

        System.out.println(obj);
        System.out.println(obj.getClass());
        System.out.println(obj.getClass().getName());

It prints:

0
class java.lang.Integer
java.lang.Integer

If this doesn't cover you, give more details

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

char c = 'a';
String s = new String("" + c);

It is easier to do this: String s = c + ""; But this is better: String s = String.valueOf(c); I have checked and the latter is faster

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I wrote this example for you:

class Person implements Comparable {

private String name = null;
private int age = 0;

// get, set methods and constructor

public int compareTo(Person other) {
  if (other==null) {
     return 1;	
  }
     if (this.age>other.getAge()) {

         return 1; //something positive

    } else if (this.age<other.getAge()) {

           return -1; //something negative
    } else { // none is greater or lower than the other
          return 0;
    }	
}


//BUT the equals MAY use something else
public boolean equals(Person p) {
   if (p==null) {
      return false;
   }
   if (name==null) {
      return name == p.getName();
   }
   return name.equals(p.getName()); 
}
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

compareTo should return an int if you want to override the one inherited by the Comparable interface.

And it doesn't have to have specific value

public int compareTo(Koerper object)
	{
		
	}

It should return a positive number if "this" object is "greater than" the argument "Koerper object"
A negative if it is "smaller than".
And 0 if they are equal. Remember if compareTo returns 0 doesn't mean the the equals method will have to return true. So you don't need to implemented.

Check the API for the comparable interface

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Nevermind I got it from this tutorial:
http://www.deitel.com/articles/java_tutorials/20060408/Arithmetic_InputMismatch_Exceptions/

//create add proper data/calculations to variables
		try
		{
			radius = input.nextDouble();
		}
		catch(InputMismatchException inputMismatchException)
		{
			
}

I believe it is better to read them as Strings and then do the converting.
What will happen if the user enters: >" 2123 "

If you read it as String then:

int i = Integer.parseInt(input.trim())

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Try to take a look at this post:

http://www.daniweb.com/forums/thread170371.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I don't agree with this:

public int pop2()
    {
    	if(evaltop >= stackArray2.length)
    	{
    		evaltop++;	
    	} 
    	return stackArray2[evaltop--];
    }

Why do increase the index when poping? All you need to check is if (evaltop>=0) If yes then you can safely pop (no ArrayIndexOutOfBoundsException because index is -1)
If no then index is -1 so the stack is empty, so don't do anything. There is no point in increasing the index since you don't put anything in the stack. With the pop you only get the element and decrease the index because you removed an element. That is why you need to check if the index is -1 to make sure that the stack has at least 1 item

Also the String.trim() method removes any trailing blank spaces and turn this String: " " into this: ""

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
public void push(char i) 
    {
      stackArray[++top] = i;
    }

Before you push anything in the array you need to check if it is full or not. If the maxsize is 10 and you the above 11 times you will get an exception. Try this:

public void push(char i) {
      top++;
      if (top >= stackArray.length()) {
            top--;
      } else {
          stackArray[top] = i;
      }
 }

Also since you put elements into these 2 arrays: stackArray, stackArray2 the same way:

stackArray[++top] = i
stackArray2[++evaltop] = j

You need their indexes to have the same start:

public Stack(int max) 
    {
      maxSize = max;
      stackArray = new char[maxSize];
      stackArray2 = new int[maxSize];
      top = -1;
      evaltop = -1;
    }
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you post the implementation of Stack class?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

As I said in my previous post:

Double hoursWorked = input.nextDouble()
if (hoursWorkedInWeek <=0.0) {

}

You read the input and put it in: hoursWorked and then inside the if you check the variable: hoursWorkedInWeek

You don't need to be a pro-programmer to realize what you are doing and what you are writing.
You put value in: hoursWorked. Aren't you supposed to know that this is the variable you need to check. From where did the hoursWorkedInWeek come from?? It doesn't have the value you read. So why do you check it?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all you open a bracket where it is not needed:

Double payRate = input.nextDouble();
System.out.println();{

//Input the  name of the employee
      System.out.printf( "Please enter the employee's  name ('stop' to quit): " );
       employeeName = input.nextLine();
      if (employeeName.equalsIgnoreCase( "stop" ) ) {
         break;}
  
         // prompt and input hours worked
       System.out.println("Please enter hours worked: " );
     Double hoursWorked = input.nextDouble();
      // read value for hours worked
      if(hoursWorked <=0.0){
          System.out.println("Hours worked cannot be negative/zero.");
      }
      else{
      // prompt and input pay rate
      System.out.println( "Please enter pay rate: " );
     Double payRate = input.nextDouble();
      System.out.println();
      if (payRate <=0.0){
          System.out.println("Hourly wage cannot be negative/ zero.");
      } 
      else{
     double weeklyPay = hoursWorked * payRate;
                PrintStream printf = System.out.printf("Weekly pay is $%.2f", weeklyPay);
}
}

I have changed the variables because you do this:

Double hoursWorked = input.nextDouble()
// read value for hours worked
if(hoursWorkedInWeek <=0.0) {


Also you get the error because you ask from the user to enter a number:

System.out.println("Please enter hours worked: " );
Double hoursWorked = input.nextDouble()

And you enter: 'stop'

stephen84s commented: To go this far with him, you really need should be given a much bigger positive rep. +5
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What is the point of having these extra brackets:

employeeName = input.nextLine();
  if (employeeName.equalsIgnoreCase( "stop" ) ) {
     System.out.println();
  }
}

Also when the user enters 'stop' you want to break, so put a break int the if.
Also if the user enters negative hourlyWageInDollars he will get the message but then the weeklyPay will be displayed.
You need to add another else after the
if ( hourlyWageInDollars < = 0 ) ,
because the result should be printed if the above is not true, inside the else

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Post your latest.
Also what are the instructions for the logic.
Do you want to break when you get any error or continue with the next loop?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hey JavaAddict,

I think I am seeing what I am doing wrong.
I need to have my "IF" statements after
my command to input the hours worked and pay rate.

IS that where I went wrong?

Thanks
IKE

Isn't that logical? First you read the input and then you validate it with if-statements.
If you don't get the input what are you going to test in the 'if'

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

i need to add tabs dynamically to the tabbedpane every tab will have jtextarea as component i tried this but everytime i click the button the first tab alone is changed..

tabbedpane=new JTabbedPane();
tabbedpane.addtab("new tab",null,textArea,null);

That is because every time you press the button a new JTabbedPane is created replacing the old. You don't need to create a new JTabbedPane only adding.
So declare the JTabbedPane as class attribute outside the methods.
when the button is clicked you will only add to the existing one

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Check this part of the code:

String line = null;
Postfix b = new Postfix(line);
				
while((line = reader.readLine()) != null) {
	line.trim();
					
	//b.evaluate();	contents.append(line).append(System.getProperty("line.separator"));
}

You have the b.evaluate in comments. But the point is that when you initialize the object you do it outside the while () where the the line is null:

String line = null;
Postfix b = new Postfix(line);

May I suggest that you put it inside the while:

String line = null;

				
while((line = reader.readLine()) != null) {
	line.trim();
        Postfix b = new Postfix(line);	
	//b.evaluate();	contents.append(line).append(System.getProperty("line.separator"));
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I am sorry for the double posting but in case you still don't get it you were supposed to replace the red comments with commands on your own and not just leave them like that.
The input will not be read by itself :)

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Because first you check the hours and the you read them.

And as for the unreachable statement, you didn't copy exactly the code given to you.

This is what was given:

if (name=='stop')
  break;

-read hours

And you wrote:

if ( employeeName.equalsIgnoreCase( "stop" ) ) {
         break;
// read value for hourly wage
         if(hourlyWageInDollars <=0.0 ){
             System.out.println("Hours worked cannot be negative/ zero." );
         }

}

In case you didn't understand the difference, here a simpler version of what you wrote:

if (employeeName.equalsIgnoreCase( "stop" ) ) {
   break;
   System.out.println();
}

You put the command after the break when it should be after the break but outside the if.

Also you DIDN'T read the code given to you, you just copied it. Read again the bold comments in verruckt24's code:


if ( employeeName.equalsIgnoreCase( "stop" ) )
break;
// read value for hourly wage
if(hourlyWageInDollars <=0.0 ){
System.out.println("Hours worked cannot be negative/ zero." );
} else if ()
{
...
}

Also there I hope you know the difference between these 2 following examples:

if () {
   command_1;
   command_2;
}
if ()
    command_1;
command_2;
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you even tried to read the advices posted here?

verruckt24's example was quite simple, not to mention it was the solution. All you needed was to replace the comments with the code to read the input (1 line)


- Read the input for the name
- use the 'if' to do the check (if stop: break)
- Read the hours worked
- Check the input (if negative break)
- Read the hourlyWageInDollars
- Check the input (if negative break)
- Since you have reached here, all the data are valid --> do the calculations


PS: I wanted to post the above algorithm but I didn't because it was what verruckt24 said and his code covered what I wanted to say completely, but it seems that we need to repeat ourselves

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

It isn't working because you never initialized the 'birthDate' variable to the person's birthday.

We posted the same time :)

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Calendar birthDate = new GregorianCalendar(); Aren't you suppose to set values to that object the input from the user?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I don't know if it is just me but I didn't understood anything from your program Could you please change the names of the variables to English?

Thanks.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Also the best way to do this is create a separate class Employee.

This may compile and run but you should never do it like this:

public static void setEmpName(String empName) {
   System.out.println(empName); // EXAMPLE
}

The empName is the name of the employee when on the other hand the PayrollProgram1 is the class where you run your program, so they need to be separate. quuba gave you this advise because probably it was the best way to correct this kind of code. And if you take a better look at your code you will see that the way you called that method was completely unnecessary

Here is an example:
1st class:

class Employee {
private String empName=null;
private int hoursWorked = 0;
private int hourlyPay = 0;

public Employee() {

}

public String getEmpName() {
  return empName;
}

public void setEmpName(String empName) {
  this.empName=empName;
}

//generate the rest of the get/set methods

public int getWeeklyPay () {
   return hoursWorked * hourlyPay;
}
import java.util.Scanner; // load scanner

public class PayrollProgram1{ // set public class
    public static void main(String[] args){ // main method begins    
        Scanner input = new Scanner(System.in); // create scanner to get input
       
        Employee empl = new Employee();
        empl.setHourlyPay(10);

        System.out.print("Enter Employee's Name."); // enter employee's name
        empl.setEmpName(input.nextLine());

        System.out.print("Enter hours worked."); // enter hours worked
empl.setHoursWorked(input.nextInt();

        System.out.printf("Employee Name: %s, Weekly Pay is $%d%n", empl.getEmpName(), empls.getWeeklyPay()); // print final line
    }
}

You might think that there isn't much difference but later you will …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

From what I understood I presume that each line in the file will have many values (probably comma separated) that need to be put in each row of a 2D array.

If this is the case then when you read the line use the split method of the String class:

String s = "a,b,c,d";
String [] array = a.split(",");

Then the array will have elements:
array[0] = a
array[1] = b
array[2] = c
array[3] = d

Afterward you can take these values and put them wherever you want

puneetkay commented: Thanks for telling abt this method! :D +2
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you again post the code, the error, and the commands you are using to compile and run

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I run the program and it works ok.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The post at the top of this forum should get you started.

Also I didn't see a question in your post. What do you expect us to do for you?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

This forum is full of examples on how to read input from the keyboard.
Do a little search.

Also check the classes:

Scanner
BufferedReader

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
boolean stop = false;

while (!stop) {

//code to be repeated 


//ask user if he/she wants to stop
if yes stop = true;
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Because when you do this:

String [][] array2D = new String[5][];

You don't create a 2-D array, but an 1-D array that takes as 'elements' arrays. So you can do this:

array2D[0] = new String[2];
array2D[1] = new String[10];
....

and access like:

array2D[0][0];
array2D[0][1];
//array2D[0][2] : this is wrong because the first element of array2D is an array with length 2. So you need to be careful with the for loops

array2D[1][0];
array2D[1][1];
...
array2D[1][9];
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

One more thing that I forgot to add in the example.
If you want the HTML to create a link like this:

<a href="viewdata.jsp?value1=John">John</a>

The jsp should be:

<a href="viewdata.jsp?value1=<%= rs.getString(1)%>"><%= rs.getString(1)%></a>

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Also when you write something outside the <% %> it is displayed the way you write (HTML style).

So when you write this:

<a href="viewdata.jsp?value1="+sth+">"+ . . .

It will not concat. It is not java and it is not a String to concat it.
If you want to display the value of a variable do this:
<%= rs.getString(1)%>
It will put whatever value it has as "part" of the HTML page.
So might want to write this:

<a href="viewdata.jsp?value1=<%= rs.getString(1)%>"><%=rs.getString(1)%></a>

No semicolon inside the <%= %> and notice the: "" of the href, as well as where the <> opens and closes:

<a href= "viewdata.jsp?value1=<%= rs.getString(1)%>" >
<%=rs.getString(1)%>
</a>


Also make sure to read peter_budo's post and follow his advice. My post was just for informative purposes. It is not correct to open database connections inside a jsp, and use the ResultSet that way to create a link

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Also a second example:

class FrameMaster extends JFrame {
  Frame1 frame1;
  Frame2 frame2;

// create somehow the 2 frames
public FrameMaster() {
  frame1 = new Frame1(this);
  frame2 = new Frame2(this);
}


 void openFrame1() {
   this.setVisible(false);
   frame1.setVisible(true);
 }

 void openFrame2() {
   this.setVisible(false);
   frame2.setVisible(true);
 }
}
class Frame1 extends JFrame {
  FrameMaster master;

 public Frame1(FrameMaster master) {
  this.master = master;
  } 

 void openMasterFrame() {
   this.setVisible(false);
   master.setVisible(true);
 }
}

class Frame2 extends JFrame {
  FrameMaster master;

 public Frame2(FrameMaster master) {
  this.master = master;
  } 

 void openMasterFrame() {
   this.setVisible(false);
   master.setVisible(true);
 }
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Version1:

class Frame1 extends JFrame {
  
  public Frame1() {
     
  }   

  private void methodClose1_Open2() {
      this.setVisible(false);
      Frame2 frame2 = new Frame2(this);
      frame2.setVisible(true);
  }
}
class Frame2 extends JFrame {
  Frame1 frame1 = null;

  public Frame2(Frame1 frame1) {
      this.frame1 = frame1;
  }   

   private void methodClose2_Open1() {
      this.setVisible(false);
      frame1.setVisisble(true);
  } 
}

Version 1:
As you can see Frame2 does NOT call a constructor. It uses the 'previous' frame that opened it (frame1).
Frame2 takes as argument a Frame1 object so you need to put the existing frame, not create a new:

Frame2 frame2 = new Frame2(this)
frame2.setVisible(true)

OR Version 2 of Frame1:

class Frame1 extends JFrame {
  Frame2 frame2 = null;

  public Frame1() {
     this.frame2 = new Frame2(this);
  }   

  private void methodClose1_Open2() {
      this.setVisible(false);
      frame2.setVisible(true);
  }
}

Again, the Frame1 constructor will be called ONCE therefor the Frame2 will be called ONCE.
Then you just use the instances to change the visibility of the frames

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What exactly are you trying to accomplish?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I got it. Here is the thing. The error you get is this:

Exception in thread "main" java.lang.StackOverflowError

If I remember correctly it usually happens when you run out of memory due some "endless loop" thing. Please someone correct me if I am wrong.

And here is the practical reason why you get an error:

In main you do this: new test0(); You create a new instance of test0. What happens when you do that? : You create a new instance of test1:

test1 t1 = new test1();
public static void main(String args[] ){
new test0()
}

What happens when you create a test1 object? :
You create a test0 object
class test1{
test0 t0 = new test0()
....
}

Then the above code calls the constructor of test0 (a NEW instance of test0) therefor a new test1 is created :
class test0{
test1 t1 = new test1();
....
}

And when you created this test1 another test0 is created, then another test1 is created then another test0 is created, .... then you get that overflow thing.

You created an 'endless loop'.
It was like doing this:

public void method1() {
    System.out.println("method1");
    method2();
}

public void method2() {
    System.out.println("method2");
    method1();
}

Execute the above code and see what happens

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

And for my insert query, i got a error saying "Number of query values and destination fields are not the same.". What does this mean?

Probably the number of values you are using are not the same with the number of columns you have in your query.
Pay more attention to puneetkay's post.
Also try posting the query you are trying to run

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
num5 = num1.subtract( num2 );

Also when you create your class and declare the private variables, you will need to implement the methods described.
Example, with the above you will have a public method he take an argument a Complex object.
Inside the method you will use the get methods of object: num2 to get the real and imaginery part, do the subtraction with the real and imaginery part of num1 and with the results create a new Complex object and return it.

I once started to create some sort of library for Complex numbers (for fun) but I got bored. It was designed to handle even calculations like: cosh(Complex x) or arctan(Complex x)

Just have get, set methods for the variables and use your Math book for the calculations.

Also you will need to implement the toString() method:

public String toString() {

}

It is automatically called whenever you do this: System.out.println(num1); or System.out.println("num 3: "+num3);

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

what would you think of a [9][9][9] array? each row and column would have an array, and so would each cell. After a number is used, you could remove it from the rows and columns, then remove it from the positions within the 3x3 square...

This is the same solution as my first.
Instead of an [9][9][9] array which would mean as you said an array [9][9] with each cell having an array with numbers and after a number is used remove it,
you could have an array [9][9] with a Vector in each cell. I thought it would be better because how do you intend to remove a number from an array?
If you had a Vector you could use the remove() method which removes the element and reduces the size of the Vector.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I had an idea once of how to do this but I didn't like it very much.
Here is what I have thought:

Each cell (81 cells) will be represented by a Vector (perhaps an array [9][9] of Vectors). Each Vector will have numbers from 1 to 9.
Suppose you want to decide what number to put at cell (i,j). You will take the values of that Vector and randomly pick one of those numbers. Once you have selected the number, You will remove that number from ALL the Vectors that are at the same row, column and square.
So when you want to decide what to put at cell (i,j+1), the Vector will have 1 less number since you removed from it the value you placed at (i,j), so again you will randomly choose a number from the existing values and you will remove that from the rest of Vectors.
In the end all the values will be removed except from one, the chosen one.

Like I said, as an initial thought it's not very smart (an array with 81 Vectors isn't very efficient).

Another thought is having a Vector with the available numbers for each row, column and square (27 Vectors) and whenever you place a number at the cell (i,j) you will remove that number from the available numbers of the specific row,column and square. Of course when you select a number for (i,j) you will need to check if …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all I think you need to remove the 'comma'

String[] fileList = { "C:/Users/workspace/emma_chapter1.txt",
"C:/Users/workspace/emma_chapter2.txt",
"C:/Users/workspace/a_christmas_carol_chapter1.txt",
"C:/Users/workspace/a_christmas_carol_chapter4.txt",
"C:/Users/workspace/pride_and_prejudice_chapter3.txt",
"C:/Users/workspace/pride_and_prejudice_chapter42.txt",
"C:/Users/workspace/spirits_in_bondage.txt",
};

Then if how to use a hashmap is your problem then why don't you try looking at the java APIs for the class HashMap. In there you can find all the methods and their explanations

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In what parameter? Are we supposed to look over your shoulder at what you typed? You create a new Scanner instance for each file in a list (or any other collection). If you're getting errors trying to do that, you need to post your code and the exact error message.

By the way, my code fragment above used the wrong constructor form (it passed the string file name instead of a File object) and has been edited accordingly.

Like Ezzaral said post your code and where you are getting the error. Also remove the throws Exception from the main. What would be the point of the method throwing an exception since no one will catch it. Also you need to add the catch (IOException ioe) { ... } after the try { .. }

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In your first method you do this: double[][] x=wc; Meaning that changes you perform to one or the other array(object) will be applied to the other because they are the same.
But if you had something like this:

double[][] x = new double[wc.length][];

for (int i=0;i<x.length;i++) {

  x[i] = new double[wc[i].length];

  for (int j=0;j<x[i].length;j++) {
     x[i][j] = wc[i][j];
  }
}

Notice this: x[j] = wc[j]; instead of what you wrote: double[][] x=wc;

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The IWT2_PO.transform method does not change anything to the first input argument. The first input argument to this function is immediately copied to a new variable. Also, shouldn't the input variable have a different scope anyway?

If it is an object it is passed by reference.
And when you say copy there are many ways to do it, and the behavior depends on the way you "copy".

Also you should post the code of the functions

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Whenever you call this: System.out.print(element); The toString() method of the object is automatically called. These 2 are exactly identical:

System.out.print(element);
System.out.print(element.toString());

If you don't override the toString() method in your class the toString method of the super class is called and in your case the toString method of the Object class

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You also want to read this:
JTextField

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

haii friends..
i want to search for a file, which resides in my own system using jsp...that is, when i click a button, a search brower is to be displayed which showing all my folders in my system and from that i want to search for the needed file...Is this possibe in jsp???

There is this tag:

<form action="">
     File: <input type="file" />
</form>

Of course you can add more attributes. (name, size).

Here is a tutorial I like to use for html:

http://w3schools.com/html/default.asp

You might want to search in what object to get the file from the request. I don't remember it right now

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I have NetBeans that makes it very easy to create a GUI. But still there are times where I still write my GUI from scratch.
Opening the text editor and writing the code.

In that way you will learn what is the difference between a JPanel and a JFrame and how to use them.

With NetBeans it may be easy to create good GUI but all you see is some ready code, that I have no idea what it does and I don't understand it.

The GUI that I write it may not be pretty but the coding is simpler. Also there are things that you can't do with NetBeans (at least I don't know how it is done so I just write the code) and if you don't know how to write your own GUI then it would be difficult to implement them.

Also no one told you to do anything. You received plenty suggestions on what IDE to use. I use NetBeans that has a GUI editor if this is what you are looking for, download it and try it.

If you don't like it try something else.
If there is something you can't do or don't understand open a new thread with your question