this be my code
import java.io.*;
public class SMarket {
public static void main (String[] args) {
java.io.BufferedReader stndin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
System.out.print("Please enter number of shares you wish to buy: ");
stndin.readLine();
System.out.println();
int r_price = 10 + (int)(Math.random() * 6);
System.out.println(r_price);
buyStock();
}
public void buyStock () {
}
}
i thought it was ok to have function belonging to the class in main. do i
have to provide a constructor for it to work?
if i do, could someone tell me the reason?
any case you''re wondering these are the errors i get:
D:\program\JCreatorV3_LE\MyProjects\Queue_LList\SMarket.java:13: non-static meth
od buyStock() cannot be referenced from a static context
buyStock();
^
D:\program\JCreatorV3_LE\MyProjects\Queue_LList\SMarket.java:8: unreported excep
tion java.io.IOException; must be caught or declared to be thrown
stndin.readLine();
^
2 errors
Press any key to continue...