java类中未找到主要方法,错误:类MovieDatabase中找不到主要方法[重复]

这个问题在这里已有答案:

错误:在MovieDatabase类中找不到主方法,请将main方法定义为:public static void main(String [] args)或JavaFX应用程序类必须扩展javafx.application.Application

import java.io.FileInputStream;

import java.util.Scanner;

import java.util.Arrays;

public class MovieDatabase {

private int[] analysis;

//creating the contructor

public MovieDatabase(String file){

analysis = new int[2015];

this.load(file);

}

//uses the load(String file) method from downstairs to do all of the work

public void load(String file){

Scanner theScanner = null;

try{

//inputing the into the scanner

theScanner = new Scanner(new FileInputStream(file));

}

catch(Exception ex){

ex.printStackTrace();

}

// as long as the scanner has another line

while(theScanner.hasNextLine())

{

String Line = theScanner.nextLine();

//make an array called split and allocated different elements based on a seperation of ##

String split[] = Line.split("##");

int year = Integer.valueOf(split[1]);

analysis[year] ++;

}

}

//print out the array in the synchronous format

public void print(){

System.out.printf("%1$-30s %2$10s %3$10s %4$10s ", "Year", "Occurances", "", "");

//go through the array

for (int i =0;i < analysis.length ;i++ ) {

if(analysis[i] >0){

for (int j =i;j < analysis.length ;i++ ){

System.out.printf("%1$-30s %2$10s %3$10s %4$10s ", j, analysis[j], "", "");

}

}

}

}

}

如何修复此错误消息?我读过其他类似的问题,但只是说让公开课 . 我是公开的 .

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值