Why is this code not working?

This is my code:

@SimpleFunction(description = "X description")

public String X1X2(String X1, String X2)

    String X3 = X2 * 2;

    {

    return X1/X2;

  }

Please Reply,
Thank You

Why you use } in middle

@SimpleFunction(description = "X description")

public String X1X2(String X1, String X2) {

    String X3 = X2 * 2;

    return X1/X2;

  }

Use this code

I used } for return
Now I deleted.
Now I got 4 errors and 1 warning.

Show me error … Fast

I personally suggest you to learn basics @SRIKAR_B.S.S

2 Likes

You developer always suggest for learn basics

This is the error:
Started Compiling Project MyBMICalculator
Buildfile: /compiler/android/build.xml

javac:
[mkdir] Created dir: /compiler/android/build/JmJFK/classes
[javac] Compiling 1 source file to /compiler/android/build/JmJFK/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /compiler/android/src/JmJFK/my/BMI/calc/SRIKAR/FunmoraDev/MyBMICalculator.java:38: error: ‘;’ expected
[javac] public String X1X2(String X1, String X2)
[javac] ^
[javac] /compiler/android/src/JmJFK/my/BMI/calc/SRIKAR/FunmoraDev/MyBMICalculator.java:46: error: reached end of file while parsing
[javac] }
[javac] ^
[javac] 2 errors
[javac] 1 warning

Why is this code not working? - #3 by Faraz_Firoz see this and use this code

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