masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, why do you disapprove of warning others to check and make sure that they are not wasting their time?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because you declare but do not define "it" so it's initial value is null, and since you are doing "+=" with String types you are getting the String value of that null reference (i.e. "null") plus the String you are appending to it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hii all please i want the answer for this Question for JAVA program:")

** How to write a java program to read the value of salary (double). if the salary is above 5000,calculate the bonus as 20% of salary.otherwise, calculate the bonus as 10% of salary ???

> > THANK YOU ..

So write one. We are not a homework service.

Closing this zombie.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

A bowel? As in intestines (I.E. your "guts")? ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

An alias in your web server configuration. This is a web server question, nothing at all to do with Java. See the documentation for your web server.

Edit: I.E. your "alias" will change "www.mydomain.com/john" to "www.mydomain.com/someservlet?someparam=john" and this can, normally, be done with wildcard expressions so you would not need to add every possibility.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By using a SelectionListener on the List to populate the textfield (essentially the same way that combobox works, behind the scenes).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Start your own thread, please.

Closing this zombie.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the API docs for DecimalFormat. Per default it will only print as many decimal places as need to display the value, which it is doing there.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And I suppose you respect all of those that wish to steal your work?

In any case, it is clearly spelled out in the policies here that we do not simply give out code so this type of question should never come, so, I feel no need to "be respectful". However, I would like to know what you found "disrepectful" there? I asked him what is problem was, what he had already tried to do about it, and informed him that he wasn't going to get a handout (whether he was looking for one or not). Reading either respect or disrespect into that is point of personal subjectivity, IMHO.

So, another question to ask now is, why did you come looking at this question in the first place? Did you have the same question with the same expectations? Were you dissappointed?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Actually, maybe this was a trick question on an SCJP type exam. It is suppossed to take a long, but a bare, non-decimal number hord-coded into code that way is an int (accepted by the method due to the "widening" principle).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Have you, as yet, done what the second line of that Note says? BTW, you did notice that is a Note and not an error, right?

minimi commented: Thank you! +0
masijade 1,351 Industrious Poster Team Colleague Featured Poster

By adding an "ALL" and using a SelectionListener together with setText to set the value in the entry portion of the ComboBox. A ComboBox cannot (AFAIK) do multiple selections. Maybe you want to use a List and TextField in tandem?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

long

Edit: As if the API docs for Thread couldn't have told you that, or what that number represents.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That has nothing to do with comboboxes and the like, but with standard classes and methods.

public class Object1 {
  public String[] getArray() {
    return new String[] { "A", "B" };
  }
}
public class Object2 {
  Object1 obj1 = new Object1();
  public void doSomeAction() {
    String[] array = obj1.getArray();
  }
}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the File class for a method to get the names of the files in a directory as an array, then use the removeAllItems of the ComboBox and the addItem method of JComboBox in a loop, then validate/repaint the JComboBox.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

pseudo code

for i ...
do
  cd ${name}${i}
  diff ...
  cd ..
done
masijade 1,351 Industrious Poster Team Colleague Featured Poster

first, i am not a boy

As in you are female or as in you are not young, as you are sure showing enough immaturity to be a "boy".

second, i want to thank yuri from my deeper heart
third, sorry yuri i made a mistake there is no error in your code
finally please for one who want to help me do that and if you don't please don,t send any words that hurt me please i am in hurry and i don't have a time still 2 hours please help me,,,

This prviding code is not helping. What have you been doing the rest of the time? The partying was just too tempting to give up, huh? Well, I want to see how you're going to handle your next assignment. As that will build on what you were suppossed to learn doing this one. But, since you didn't do it you didn't learn anything, so you're just that much farther behind now. Own up to your behaviour and take the failing grade.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Finished. Let me see yours.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then this is a JavaScript question. A function and a Div, not hard.

Moving to JavaScript forum.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Gootle HTML refresh

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yeah, actually learn the language (there are plenty of tutorials and API docs) rather than simply copying random blocks of code.

Why don't you tell us what you think that code is doing (line for line), see the API docs for help. At least that way you will have to actually analyse the code and learn what it does so that you are actually capable of using and modifying it, rather than just having others provide you with code that won't help you in future endeavors.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I need to use this in scriplet.

No you don't, you shouldn't be using scriptlets in the first place.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Because that check in the while loop takes much less than a single millisecond to execute, so, "subtracting a millisecond" is every iteration is, of course, faster than "realtime". Simply keep checking the currentTime against the "startTime", and set the "startTime" to the currentTime as soon as it is at least 1000. You do know that your CPU usage will jump to 100% doing this, right? This is what is called "busy looping". That is why you should be using things like sleep and wait.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No idea what you're really talking about, but this seems more of a JavaScript/HTML question (i.e. how to write it properly) than a JSP question (since the actual action seems to work, according to your statement, but that you cannot get the HTML/JavaScript the way you want it).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's not an "apache setting". It is a "Web Container"/"Application Server" configuration. I.E. Tomcat, Glassfish, Sun Application Server, WebSphere, WebLogic, JBoss, Jetty, etc. Find out which one you are going to use and read its documentation.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

If you are actually talking about JSP, then that is an HTML question, as the HTML produced by the JSP is what will control that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I just need to know how to use this

class NewThread implements Runnable
{
    Thread t;
    NewThread ()
    {
        // Create a new, second thread
        t = new Thread (this, "Demo Thread");
        System.out.println ("Child thread: " + t);
        t.start (); // Start the thread
    }
    public static void main (String [] args)
    {
      
    }

    // This is the entry point for the second thread.
    public void run ()
    {
        try
        {
            for (int i = 5 ; i > 0 ; i--)
            {
                System.out.println ("Child Thread: " + i);
                // Let the thread sleep for a while.
                Thread.sleep (500);
            }
        }
        catch (InterruptedException e)
        {
            System.out.println ("Child interrupted.");
        }
        System.out.println ("Exiting child thread.");
    }
}

class ThreadDemo
{
    public static void main (String args[])
    {
        new NewThread (); // create a new thread
        try
        {
            for (int i = 5 ; i > 0 ; i--)
            {
                System.out.println ("Main Thread: " + i);
                Thread.sleep (1000);
            }
        }
        catch (InterruptedException e)
        {
            System.out.println ("Main thread interrupted.");
        }
        System.out.println ("Main thread exiting.");
    }
}

By calling new Thread(Runnable) and start(). See the linked tutorial and at least try.

And, in fact, that code does that already (not that I really agree with that constructor, but hey, to each his own). Now you want us to provide more code to show you how to use code that already does what you want us to show you? If you haven't been able to get that out of studying this code, how would us providing more code help?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Here is the concurrency tutorial as a starting place: http://download.oracle.com/javase/tutorial/essential/concurrency/index.html

Which I provided in the first reply. ;-)

Ezzaral commented: Indeed :) +14
masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can find that in the documentation.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Simply call the add method, then validate and/or repaint.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Lets see yours, and we'll help you fix it, otherwise see this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

We are not a free pool of slaves. We will help you correct what you have but we will not do it for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Why should we do your work, and/or your research, for you?

This is your project so do it. Gods I am really getting sick and tired of the feel of entitlement kids have these days (I know, we all had it, but it just seems so much worse than it used to be).

Do something, if it "doesn't work" post the relevant portions of it here, along with all compiler/error messages, and a complete, but brief description of the difference between the actual and expected behaviour/output, and we will help you to correct it. We are not, however, even going to think about doing it for you.

If you haven't got the first clue as to how to do it, then pick a "mini-project" about which you do have a clue, or learn (what you probably should have already have learned) what you need to learn to do that project.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

how can i ask my teacher
he will never help us becase it's ahomework as an asimint

Which makes it his job to help you when you have questions about it. And, no, he won't do it for you and neither will we. As I said before, that is not helping.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then all I can say is, I'm sorry. If that's your best attempt you need to start looking for a different line of work to study for.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And so you waited until the last minute to get it clarified? Which only your instructor can do, BTW.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

no sir i did it with my frind yesterday

That makes it even worse than. There are two of you and that's the best you can come up with? Probably he got it from another forum without telling you, or he was f'ing with you himself.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Also, in response to your PMs. Doing your homework for you is not helping you. You would only be that much more lost tomorrow than you are today when you get an assignment that builds on what you were suppossed to have learned today (which you learn nothing if someone else does it).

And I do "understand your situation". You had homework to do and you put it all off until the last minute (probably partying instead) and now you don't have enough time to do them (and don't know how to in the first place since you've probably been sleeping in class because of being fatigued from all the partying). Well, live with the consequences of your decisions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So what compiler messages do you get? What errors do you get when running it? How does the expected output differ from the actual output?

As a few points:

Where is the parameterised constructor?
Where are all of the "emp" methods?

And, let me guess, you copied this from yet another forum that "gave" it to you as an answer. Well, they were f'ing with you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

In case you haven't guessed it yet, we are not a homework and are not going to do it for you. Now stop flooding the forum with BS and get to work and maybe you'll actually be able to finishe one or two of them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay. Finished.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It looks okay, but I'm not going to try it either. As far as the "<Contact>" see this.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Except that contact in the "new Contact" lines needs to be capitalised in both places, of course. And I would do

ArrayList<Contact> contactObj = new ArrayList<Contact>();
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Classpath, classpath, classpath. Include the jars that contain those packages on your classpath with the -cp option when using javac or added as a library in your project.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

By reading the tutorials.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
conList.split("\\s+")

Read the rest of the introduction to the Pattern class.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The content of the while loop expression is incorrect, read further down in that provided tutorial until you find where readLine is actually used in that tutorial. And you should use the regex for "one or more whitespace" (see the API docs for Pattern), rather than a single space in your split.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Yes, the cwd is that of the java program, of course. The linked document (if I remember right) covers this point. If the batch script depends on cwd, then you are going to have to change the batch script or write another batch that does a cd then calls the batch script you actually wanted to call.

The other option is to read the API docs and pay attention to the ProcessBuilder class (and its directory method), as Runtime.getRuntime().exec() should not be done directly anymore. You have finer and fuller control using ProcessBuilder.