Java不包含主类型_java - 为什么会出现“编辑器不包含主类型”错误? - 堆栈内存溢出...

我正在研究此分配,以便从尝试/捕获主要方法中获得一种方法,并在新方法中使用扫描仪和印刷机,以进行此数组读写代码。 但是我一直收到此错误:“编辑器不包含主类型。” 可能是什么原因?

任何帮助表示赞赏,谢谢

(所有扫描仪..等导入这里)

public class Program_11_1

{

public static void main(String[] args)

{

String file_name;

String outputFileName = null;

String done_string = "done";

boolean done = false;

while (!done)

{

file_name = JOptionPane.showInputDialog("Enter a file

name"

+ " or done to exit: ");

if (file_name.equals(done_string))

{

done = true;

JOptionPane.showMessageDialog(null,

"EXITING");

}

else

{

Scanner input = get_Scanner(file_name);

outputFileName = JOptionPane.showInputDialog(null,

"Enter the output file name: ");

PrintWriter output_writer =

get_Writer(outputFileName);

Scanner input_counter =

get_Scanner(file_name);

if ((input != null && output_writer != null &&

input_counter != null))

{

//********TASK

CODE**************

// Use Scanner input_counter

to determine the number of integers

// in

int num_ints =

size(input_counter);

// Create an integer

array of size ; named

int[] int_array =

return_Array(num_ints);

// Read the integers

in into

fill_Array(int_array,

input);

// Sort the integers

in to run from lowest (at [0]

// to highest at

[ - 1]

int ordered_array[] =

order_Array(int_array);

// Write the integers

in the sorted array to

print_Array(ordered_array, output_writer);

//*******END TASK CODE************

}

input.close();

input_counter.close();

output_writer.close();

}

}

}

public static Scanner get_Scanner(String file_name) {

try

{

File file_in = new File(file_name);

Scanner input = new Scanner(file_in);

JOptionPane.showMessageDialog(null, "File " +

file_name + " found ");

return input;

}

catch (FileNotFoundException e) {

JOptionPane.showMessageDialog(null, "File " +

file_name + " not found");

return null;

}

}

public static PrintWriter get_Writer(String out_file_name) {

try

{

PrintWriter output_writer = new

PrintWriter(out_file_name);

JOptionPane.showMessageDialog(null, "created output

file: " + out_file_name);

return output_writer;

}

catch (FileNotFoundException e)

{

JOptionPane.showMessageDialog(null, "output file

FAILED");

return null;

}

}

}

}

(不包括size,return_Array,int_array,order_Array,print_Array方法,这些都可以)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值