public class solve{
public static void main (String []args){
A cs = new A();
int first=34;
int second=4;
System.out.println("Sum:" + cs.add(first,second));
System.out.println("Difference:" + cs.subtract(first,second));
}
}

i got this code, unfortunately it refuses to run.. please help..
Something is wrong with "A", dnt know what it is...:(

Edited 3 Years Ago by happygeek: fixed formatting

What is "A"? You are trying to create an object of type "A", but from the code you have posted, no such class exists...

im not really good in making classes.. some gave this to me but i don't fully understand...

this is the code i guess...

public class Greeting{
    private String Salutation;

    Greeting (String s){
        Salutation = s;
    }

public void greet (String whom){
    System.out.println (Salutation + " " + whom);
}
}

together with this one...

public class TestGreeting{

    public static void main (String[] args){

        Greeting Hello = new Greeting ("Hello");

        Hello.greet ("World!");
    }
}

please help me on this... tnx... :$

Edited 3 Years Ago by pyTony: fixed formatting

Is there a problem with that second example?

It looks unrelated to your original post, what exactly do you need me to help you with?

i got this code, unfortunately it refuses to run.. please help..
Something is wrong with "A", dnt know what it is...

im not really good in making classes.. some gave this to me but i don't fully understand...

this is the code i guess...

Now how are we supposed to help you on this information given by you ???
If you are not good at creating classes, I recommend you purchase a good book like "Head First Java" or something similar which till teach you object oriented programming along with Java.
Also the "Starting Java" thread at the top as the name suggests has been created specifically for users like yourself who are just begining to do programming.

Also asking questions like the one above and asking us to fix it will only make you more dependent on others to get your work done and if you intend making a career in this field, I am pretty sure you do not want that.

propably the wrong part is that you do not have a class A, so you're trying to instantiate and use an object type that doesn't exist.
create the class and try it again

propably the wrong part is that you do not have a class A, so you're trying to instantiate and use an object type that doesn't exist.
create the class and try it again

thanks anyway, :?: and Advance Merry Christmas....

propably the wrong part is that you do not have a class A, so you're trying to instantiate and use an object type that doesn't exist.
create the class and try it again

ok i'll try....

the second problem seems to be ok by me
to run the code simply use
javac TestGreeting.java
then
java TestGreeting
it should run with out any problem

the second problem seems to be ok by me
to run the code simply use
javac TestGreeting.java
then
java TestGreeting
it should run with out any problem

the second problem seems to be ok by me
to run the code simply use
javac TestGreeting.java
then
java TestGreeting
it should run with out any problem

a more than obvious and useless answer: since the thread-starter had errors while running the code, it is safe to assume he/she has already figured out how to run a java app.

was it really necessary to post this twice?

a more than obvious and useless answer: since the thread-starter had errors while running the code, it is safe to assume he/she has already figured out how to run a java app.

was it really necessary to post this twice?

Have you thought if he was executing the wrong code since there will be two classes. I he said he had problem with classes, now he has two class and one does not have a main method. What would happen if it was that particular one he was trying to execute
So pls think twice before you send your post

This article has been dead for over six months. Start a new discussion instead.