Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Really simple Java question

Featured Replies

I must be losing it. Every time I try to compile this simple program it is giving me a "illegal start of type" error.

import java.util.Random;

public class tesn{
public void hi(void){
System.out.println("DoSTuff");
}
public static void main(String args[]){
hi();
}
}

The filename is called tesn.java. I have no idea why this does not work.


I must be losing it. Every time I try to compile this simple program it is giving me a "illegal start of type" error.

import java.util.Random;

public class tesn{
public void hi(void){
System.out.println("DoSTuff");
}
public static void main(String args[]){
hi();
}
}

The filename is called tesn.java. I have no idea why this does not work.

Shouldn't it be something like this --

import java.util.Random;

public class test{
public void hi(void){
System.out.println("DoSTuff");
}
public static void main(String args[]){
hi();
}
}

You have "public class tesn{" and I think it should be "public class test{"

  • Author

Nope that isn't it. The class name "tesn" matches the name of the file "tesn.java". It's an odd name, but as long as it matches it should work.

Edit: I figured it out. The void isn't suppost to be where the arguments are. I hate it when I confuse languages.

Edited by I_Broke_My_MHZ

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.