[英]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.