【问题标题】:android java string operation [closed]android java字符串操作[关闭]
【发布时间】:2014-12-14 05:51:02
【问题描述】:

这个 PHP 代码的等效 Java 是什么?

//print string plus/with variable     
$mystring = "this is string " .$string

//print sum one + two
$count = $one + $two

//print sum one*two
$count = $one * $two

【问题讨论】:

  • 对于那些懂java但不懂php的人,代码是做什么的?
  • 这和安卓有什么关系?
  • @azurefrog 我只想知道如何在java上运行这个操作
  • 这是一个php代码,你想把它转换成java吗?

标签: java equivalent


【解决方案1】:

应该是这样的:

String mystring= "this is string " + string; // here `string` is aloso  String  object

/*
* if count ,one and two all of them are int
*/
int count = one + two;

int count = one * two;

但我建议在开始 android 之前学习 java 的基础知识。正如你所知道的 php,学习 java 语法不会花很长时间。

【讨论】:

  • 不,他们不是java.lang.Integer。它们是原始的int
  • 搞错了谢谢指点。 @LittleChild
  • 不客气! :) +1 进行更正。
猜你喜欢
  • 2012-09-27
  • 1970-01-01
  • 1970-01-01
  • 2013-10-17
  • 2016-06-29
  • 2014-09-18
  • 2019-03-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多