[英]Global variables in C++ to Java
如何用Java編寫C ++的所有這些全局變量?
//Global variables
int charClass;
char lexeme [100];
char nextChar;
int lexLen;
int token;
int nextToken;
extern string word("Apple");
類中的公共靜態變量如何?
public class Globals {
public static int charClass;
public static char[] lexeme = new char[100];
public static char nextChar;
public static int lexLen;
public static int token;
public static int nextToken;
public static String word = "Apple";
}
雖然存在一些差異,但是主要思想是相似的(至少對於原始元素而言)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.