有没有试图写这样的代码
Java:
C#:
是的,这样的代码是可以正确运行的。
在你的程序中有没有考虑使用中文的变量名呢?
Java:
package novelty.function.test;
public class ChinesePrograme {
public static void main(String[] args){
String 中文变量 = "english";
System.out.println(中文变量);
}
}
public class ChinesePrograme {
public static void main(String[] args){
String 中文变量 = "english";
System.out.println(中文变量);
}
}
C#:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
String 中文变量 = "english";
Console.WriteLine(中文变量);
}
}
}
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
String 中文变量 = "english";
Console.WriteLine(中文变量);
}
}
}
是的,这样的代码是可以正确运行的。
在你的程序中有没有考虑使用中文的变量名呢?
本文展示了如何在Java和C#中使用中文变量名,并提供了示例代码。通过这些示例,开发者可以了解到在实际编程中使用非英文字符作为变量名的可能性。
1327





