我希望用户输入他的名字并受到控制台的欢迎。在这里找不到我在做什么错...
编辑:确定看起来像Console.Read
是问题所在。不知道为什么。
using System;
namespace Program1
{
// use can use regions to wrap code in them and they can be collapsed
#region
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter ur name : "); // showing a msg to user
string name = Console.ReadLine(); // defining a string variable and getting input from user
Console.WriteLine("Hello " + name); // saying hi to user by adding his name that we asked earlier
Console.WriteLine("Press any key to terminate ...");
Console.Read;
}
#endregion // use can use regions to wrap code in them and they can be collapsed
}
}
答案 0 :(得分:1)
Console.Read后缺少括号,请按照private PictureCallback mPicture = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (pictureFile == null){
Log.d(TAG, "Error creating media file, check storage permissions");
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d(TAG, "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d(TAG, "Error accessing file: " + e.getMessage());
}
}
};