NDK and the final keyword usage [on hold]

I have two classes one is written in Java and the other one is in C++. Name them as Some.java and Some.cpp.

I'm sending an int argument to the method in C++ part from the Java part. Look at the code below:

int someIntegerArgument = 3; String dummyValue = getSomeValueFromCpp(someIntegerArgument);  // The above code lies in Some.java  // The below code lies in Some.cpp  extern "C" jstring Java_com_company_my_SomeActivity_getSomeValueFromCpp(     JNIEnv *env,     jobject,     jint someIntegerValue) {     // Some code } 

Here the problem is that the jint argument is passed as a random value, not 3!

I've solved this issue by making the int argument as final. final int someIntegerArgument = 3;

Since I'm not a Java developer I'm wondering what's the point of using such approach? Why does the code fail without using the final keyword?

Replay

Category: applications Time: 2016-07-28 Views: 0
Tags: applications

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 5.380 (s). 13 q(s)