Why is this code not working?

I already used it, but still 2 errors

1 Like

Send here error… @SRIKAR_B.S.S

Started Compiling Project XXXX
Buildfile: /compiler/android/build.xml

javac:
[mkdir] Created dir: /compiler/android/build/acFNl/classes
[javac] Compiling 1 source file to /compiler/android/build/acFNl/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] Note: Wrote file file:/compiler/android/build/acFNl/classes/simple_components.json
[javac] Note: Wrote file file:/compiler/android/build/acFNl/classes/simple_components.txt
[javac] Note: Wrote file file:/compiler/android/build/acFNl/classes/simple_components_build_info.json
[javac] Note: Wrote file file:/compiler/android/build/acFNl/classes/AutogeneratedOdeMessages.java
[javac] Note: Wrote file file:/compiler/android/build/acFNl/classes/ComponentsTranslation.java
[javac] /compiler/android/src/acFNl/my/BMI/calc/SRIKAR/FunmoraDev/MyBMICalculator.java:40: error: bad operand types for binary operator '*'
[javac] String X3 = X2 * 2;
[javac] ^
[javac] first type: String
[javac] second type: int
[javac] /compiler/android/src/acFNl/my/XXXX/calc/SRIKAR/FunmoraDev/XXXX.java:41: error: bad operand types for binary operator '/'
[javac] return X1/X2;
[javac] ^
[javac] first type: String
[javac] second type: String
[javac] 2 errors

So …?

Basics arent learnt in just some weeks, it personally took me 9months

1 Like

Use int on the place of String because * use in math

Now I updated everything

My Code:

@SimpleFunction(description = "X description")

public String X1X2(String X1, String X2)

    int X3 = X2 * 2;

{

    return X1/X2;

}

My Error(1)

Started Compiling Project XXXX
Buildfile: /compiler/android/build.xml

javac:
[mkdir] Created dir: /compiler/android/build/HlyXH/classes
[javac] Compiling 1 source file to /compiler/android/build/HlyXH/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /compiler/android/src/HlyXH/my/XXXX/calc/SRIKAR/FunmoraDev/XXXX.java:38: error: ';' expected
[javac] public String X1X2(String X1, String X2)
[javac] ^
[javac] 1 error
[javac] 1 warning

As I told you can not use { in middle you can dm me I tell you evrything

My advice would be the same, Learn the basics first because the code you wrote contains very basic mistakes. Make some program in java to clear the coding syntax

2 Likes
@SimpleFunction(description = "X description")

public int X1X2(int X1, int X2) {

    int X3 = X2 * 2;

    int result = X1/X2;

    return result;

}

Use this code this do not give error

Try this one -

@SimpleFunction(description = "X description")
public int X1X2(int X1, int X2) {
    int X3 = X2 * 2;
    int result = X1/X2;

    return result;
}

Even I suggest you to learn basics.

7 Likes

@Faraz_Firoz
I found you like to answer, but please verify your answer before sending …

You have claimed to made different extensions but atleast you should know that ,
int can't be converted into String

4 Likes

Welcome to the community @oseamiya aka Sneha Sharma

2 Likes

You are :100:% correct.

1 Like

Oh sorry that’s my mistake

That’s why everyone say - Learn basics.

Is you do not make mistake
Also If we do not make mistake then who make mistake

Don’t get angry. :joy::joy::joy:

#off topic

@Faraz_Firoz

1 Like

Thankyou @SRIKAR_B.S.S :heart:

2 Likes

My code does not work please answer this