我有,我想存儲水平作爲靜態Java類的的Android遊戲。 Java中以下JavaScript對象的等效代碼是什麼?什麼是Java相當於Javascript中的多維對象?
var Levels = {
Level1:{
shapes:[
{
bodytype : "dynamic",
h : "50.0000",
nameid : "hofN7-1",
props : {
id : "properties"
},
rotation : "0.0000",
type : "square",
uid : "Av2EZQh",
w : "50.0000",
x : "20.0000",
y : "20.0000"
},
{
bodytype : "dynamic",
h : "50.0000",
nameid : "hofN7-2",
props : {
gravMassScale : "2",
id : "properties",
inertia : "2",
isBullet : true,
torque : "2",
velocity : {
x : "2",
y : "2"
}
}
}
...
我想'Map'是在行爲上最近的,如果你不希望創建一個新的類(或多個新類)。 – nhahtdh 2013-05-01 10:29:31
也許你應該首先學習java基礎知識? – Bart 2013-05-01 10:34:46
類和屬性是你正在尋找的。基本的OOP。 – jlordo 2013-05-01 10:37:38