-3

I am very new at coding in Java and I want to write a code to find out my operating system through a dialogue box (Windows). I wrote this code but I am not sure how to completely implement it.

Please let me know what I am doing wrong in simple terms as I am a beginner.

import java.awt.*;
import javax.swing.*;


public class JavaTut {
  public static void main(String[] args) {
    JOptionPane.showMessageDialog(null,System.getProperty("os.name").list(System.out));
    Toolkit.getDefaultToolkit().beep();
 }
}
sazzad
  • 5,740
  • 6
  • 25
  • 42
Biogrid
  • 21
  • 5

1 Answers1

2

Instead of System.getProperty("os.name").list(System.out), use System.getProperty("os.name").

Example main method:

public static void main(String[] args) {
    JOptionPane.showMessageDialog(null, System.getProperty("os.name"));
}
sazzad
  • 5,740
  • 6
  • 25
  • 42