最好的办法,真正神交的Java ME为一个C#的家伙 [英] Best way to really grok Java-ME for a C# guy

查看:175
本文介绍了最好的办法,真正神交的Java ME为一个C#的家伙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始开发黑莓应用。因此,我不得不跳的Java ME和学习及其相关工具。语法是容易的,但我一直与各种陷阱和环境有问题。

I've recently started developing applications for the Blackberry. Consequently, I've had to jump to Java-ME and learn that and its associated tools. The syntax is easy, but I keep having issues with various gotchas and the environment.

例如,一些让我感到惊讶和浪费了大量的时间是没有一个类对象不动产的(东西我假定所有OOP语言了)。有很多陷阱。我去过他们比较Java语法VS C#各个地方,但似乎没有被任何网站,告诉的事情看出来移动到Java时。

For instance, something that surprised me and wasted a lot of time is absence of real properties on a class object (something I assumed all OOP languages had). There are many gotchas. I've been to various places where they compare Java syntax vs C#, but there don't seem to be any sites that tell of things to look out for when moving to Java.

环境是一个整体的另一个问题都在一起。黑莓IDE简直是太可怕了。外观让我想起了B​​orland的C ++为Windows 3.1 - 它是过时的。一些其他的问题包括智能感知参差不齐,弱调试等..黑莓确实有Eclipse插件的测试,但没有调试支持,它只是花哨的重构工具的编辑。

The environment is a whole other issue all together. The Blackberry IDE is simply horrible. The look reminds me Borland C++ for Windows 3.1 - it's that outdated. Some of the other issues included spotty intellisense, weak debugging, etc... Blackberry does have a beta of the Eclipse plugin, but without debugging support, it's just an editor with fancy refactoring tools.

因此​​,在任何意见如何融入到Java-ME?

So, any advice on how to blend in to Java-ME?

推荐答案

家伙不得不做出反向转移。于是,他列出Java和C#的十大区别。我会带他的主题和展示它是如何在Java中提出:

This guy here had to make the inverse transition. So he listed the top 10 differences of Java and C#. I'll take his topics and show how it is made in Java:

要打印到标准输出在Java中:

To print to the standard output in Java:

System.out.println("Hello");

疑难杂症#9 - 命名空间==自由

在Java中,你没有命名空间的自由。类的文件夹结构必须包的名称相匹配。例如,在包一类的 org.test 的必须是在文件夹中的组织/测试

Gotcha #9 - Namespaces == Freedom

In Java you don't have the freedom of namespaces. The folder structure of your class must match the package name. For example, a class in the package org.test must be in the folder org/test

在Java来参考您使用保留字超超级而不是

In Java to refer to the superclass you use the reserved word super instead of base

您没有在Java中有这样的。你必须自己去调用构造函数

You don't have this in Java. You have to call the constructor by yourself

要继承一个类在Java中做到这一点:

To subclass a class in Java do this:

public class A extends B {
}

这意味着类 A 是类的子类 B 。在C#是类A:B

That means class A is a subclass of class B. In C# would be class A : B

要在Java中使用关键字定义常量最后而不是常量

To define a constant in Java use the keyword final instead of const

在Java中最常用的数据结构是 HashSet的的ArrayList 的HashMap 。他们实施设置列表地图。当然,还有一帮多。了解更多关于收藏这里

The most used data structures in java are HashSet, ArrayList and HashMap. They implement Set, List and Map. Of course, there is a bunch more. Read more about collections here

您不必在Java性能的工具。你必须声明获取和设置方法为自己。当然,大多数的IDE可以自动做到这一点。

You don't have the properties facility in Java. You have to declare the gets and sets methods for yourself. Of course, most IDEs can do that automatically.

您不必申报虚拟 Java中的一个方法。所有的方法 - 除了那些宣称最后 - 可以用Java重写

You don't have to declare a method virtual in Java. All methods - except those declared final - can be overridden in Java.

在Java中的原始类型 INT 浮动双击字符不是对象就像在C#。他们都有各自的对象重新presentation,如整数浮动

In Java the primitive types int, float, double, char and long are not Objects like in C#. All of them have a respective object representation, like Integer, Float, Double, etc.

就是这样。不要忘了看原链接,有一个更详细的讨论。

That's it. Don't forget to see the original link, there's a more detailed discussion.

这篇关于最好的办法,真正神交的Java ME为一个C#的家伙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆