Simple Addition Program In J2me

Posted on  by

Learn how to use arithmetic operators in java for more information visit our website: http://sharexact.com/. In Java Programs Comments Off on Java Program Sum Of N Numbers 4 Simple Ways Java program to calculate the sum of N numbers using arrays, recursion, static method, using while loop. Here is the complete Java program with sample outputs. Simple Java is a collection of frequently asked Java questions. You can download the PDF version here for free. If you like digrams and simple exmples in this. Tags: Calculator program using J2ME, J2ME programs, MCC programs, MIDLET programs 0 Problem Definition: Write a J2ME program to implement a Calculator with add,subtract,multiply and division functions(Use buttons).

Active2 years ago

do anyone know some C or C++ interpreter for cell phones? I have Nokia 5310 and found some Basic interpreter (CellBasic) and want to develop in C or C++ on the go. Or, does anybody knows Scheme J2ME intepreter?

Simple Addition Program Using jQuery In the following example is the very simplest addition program using jQuery, jQuery is the framework of javascript, jQuery is the plugin created using pure javascript code. The jQuery can easy to do to program.

Vadim Kotov
5,3887 gold badges36 silver badges49 bronze badges
Garret RazielGarret Raziel

closed as off-topic by bfontaine, Patrice Bernassola, Yadhu Kiran, Cleb, RobAug 18 '17 at 13:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – bfontaine, Patrice Bernassola, Yadhu Kiran, Cleb, Rob

Simple Addition Program In Java

If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

You don't want to do a C interpreter in J2ME unless you first compile it to bytecode elsewhere: you'd waste a lot of space with the parser.

If you're interested, I have my own interpreter that's used by various people and companies called Hecl, at http://www.hecl.org

It's fairly simple, but has commands to access a variety of things, and is under active development, with a nice user community.

David N. WeltonDavid N. Welton

A lot of Symbian uses JIT. Most of Sony Ericsson devices uses AOT. Lots of Nokia S40 devices uses Jazelle. JIT, AOT and Jazzele have some advantages and disadvantages but I'm sure that they're much faster than plain interpreter (like Nokia 3120's JVM).

However, there is one performance issue. There are several ways to run code in Java, e.g.:

  1. interpreter (it can use AST)
  2. generating bytecode + special ClassLoader
  3. generating bytecode and creating special jarfile
  4. using JNI

Way no 1 is possible but slow.

Way no 3 can be fast but it can be really uncomfortable and difficult to implement without library like BCEL or ASM. (I can imaginate comfortable implementation running on Sony Ericsson Java Plarform 8.5+ devices that offers to install generated app and then launches the app. Note that JP 8.5 currently support two phones: Yari and Aino.)

Ways no 2 and 4 are not feasible with J2ME CLDC.

Rappa ternt sanga t-pain rar apps. Lyrics T-Pain Goddamn Lil Mama You know you thick as hell you know what I'm saying Matter fact After the club you know what I'm talking bout Me and my niggas gone be together u know what I'm saying I ain't goin' worry bout them really though I'm just looking at you Yea you know You got them big ass hips god damn!

v6ak

Simple Addition Program In Python

v6ak
1,3002 gold badges10 silver badges26 bronze badges

j2me is notoriously slow. I can only shiver when thinking how slow it would get if it had to interpret another language. ;^)

ToadToad
10.6k11 gold badges67 silver badges122 bronze badges

Not the answer you're looking for? Browse other questions tagged c++cmobilejava-meinterpreter or ask your own question.

Active4 years, 6 months ago
$begingroup$

I've been learning Java for about 3 weeks now, and I was hoping someone could check over my code for me, and let me know how to improve.

I am aware that the maths class could be removed (I could've typed answer = inputA * inputB etc. within the switch statement) but this is just because I wanted to practice using multiple classes.

And my second class..

Pimgd
21.3k5 gold badges59 silver badges142 bronze badges
JimJim
$endgroup$

2 Answers

$begingroup$

For a beginner it's a good approach. You need to know about Java Naming Convention. We use mixed case for naming any variable or instance of a class. So in your code Maths Maths = new Maths(); should be Maths maths = new Maths();.

Or even better make all the methods in Maths class public static as the instance of the class doesn't play any part in computation. Point to be noted in Java we make utility class's methods static as you can see in API's Math class, Array class.

Suggestions

  • In add, subtract methods you don't need to introduce a new answer variable. Just return the result like return (a+b); or return (a-b);.
  • while (done false) is yukkk. Just make it while (!done).

Thumbs up for closing the Scanner. Now read about Exception handling. Happy programming!!! :D

Anirban Nag 'tintinmj'Anirban Nag 'tintinmj'
$endgroup$$begingroup$
  • power should probably be using Math.pow(). I'm picturing how slow your code would be at calculating 1.00000015000000. Or how inaccurate it'll be when someone wants to raise to a non-integer power. If those are not intended to be allowed, then passing doubles all over the place seems odd. But it'd be better to check beforehand and throw an error than return a blatantly incorrect result, in my opinion.

  • You never set done to true, and thus have an infinite loop; take out the flag and say while (true) or for (;;), so that that's apparent. Don't add the flag back til you're also adding the code that sets it.

  • The fact that you use objects doesn't make your code object-oriented. How you use them is what makes the difference. In this case, you're using classes as namespaces for functions, which is not very object-oriented at all.

    In your case, Maths is entirely useless; everything it does would be better done in your own code. This is an example of gratuitous use of objects. If you wanted to practice your OOP, you might want to think about how you'd get rid of that switch statement. Hint:

cHaocHao

Simple Addition Program In C

$endgroup$

protected by 200_successApr 7 '14 at 5:47

Simple Addition Program In C++ Show In Youtube Use Cin

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Simple Addition Program In J2men

Not the answer you're looking for? Browse other questions tagged javabeginnercalculator or ask your own question.