用户定义数组的方法头

时间:2018-11-07 22:38:01

标签: java arrays methods

Private WithEvents Items As Outlook.Items
    Private Sub Application_Startup()
    Dim objNS As Outlook.NameSpace
    Set objNS = GetNamespace("MAPI")
    Set Items = objNS.GetDefaultFolder(olFolderDrafts).Items
    Set objNS = Nothing
    End Sub

    Private Sub Items_ItemAdd(ByVal Item As Object)
    EmailOutlookDraftsMessages
    End Sub

    Public Sub EmailOutlookDraftsMessages()
    Dim lDraftItem As Long
    Dim myOutlook As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myFolders As Outlook.Folders
    Dim myDraftsFolder As Outlook.MAPIFolder
    Set myOutlook = Outlook.Application
    Set myNameSpace = myOutlook.GetNamespace("MAPI")
    Set myFolders = myNameSpace.Folders
    Set myDraftsFolder = myFolders("R.E.L.s_email@fake.com").Folders("Drafts")
    For lDraftItem = myDraftsFolder.Items.Count To 1 Step -1
    If Len(Trim(myDraftsFolder.Items.Item(lDraftItem).To)) > 0 And InStr(myDraftsFolder.Items.Item(lDraftItem).Subject, "WO# ") > 0 Then
        myDraftsFolder.Items.Item(lDraftItem).Send
    End If
    Next lDraftItem
    Set myDraftsFolder = Nothing
    Set myNameSpace = Nothing
    Set myOutlook = Nothing
    End Sub

这是我让用户输入数组大小的代码的一部分,但是我的任务是使用下面的标头只是一种获取数组大小的方法,但是我尝试插入它并不断获取不同的错误消息,例如根据需要的正文(如果我使用分号)或“ requires';'”(如果我不这样做),并且当我在获取数组大小的部分周围放置花括号时,将返回错误:语法错误,插入“ []”完成尺寸     -语法错误,插入“;”完成BlockStatement     -令牌“创建”的语法错误,预期在AnnotationName之后      这个令牌

public class studentDriver {

    public static void main(String[] args) {


        Scanner scan = new Scanner(System.in);


        System.out.print("How many students are there?: ");
        int numberOfstuds = scan.nextInt();

        int[] nOEarray = new int[numberOfstuds];

        System.out.println("\nEnter names of students up to the entered amount (" + numberOfstuds + "):");

        String[] namesArray = new String[numberOfstuds];

        for (int i = 0; i < numberOfstuds; i++) {
            namesArray[i] = scan.next();
        }
        System.out.println(Arrays.toString(namesArray));
    }
}

这是学生班

public static Student[] create()

0 个答案:

没有答案