fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. private Long id;
  11. private String productName;
  12. private String supplierName;
  13.  
  14. public void setId(long i)
  15. {
  16. id=i;
  17. }
  18. public void setProductName(String s)
  19. {
  20. productName=s;
  21. }
  22. public void setSupplierName(String s)
  23. {
  24. supplierName=s;
  25. }
  26. public long getId()
  27. {
  28. return id;
  29. }
  30. public String getProductName()
  31. {
  32. return productName;
  33. }
  34. public String getSupplierName()
  35. {
  36. return supplierName;
  37. }
  38. }
  39. class Main{
  40. public static void main(String args[])
  41. {
  42. Product description=new Product();
  43. Scanner temp=new Scanner(System.in);
  44. System.out.println("Enter the product id");
  45. long id=temp.nextLong();
  46. description.setId(id);
  47. System.out.println("Enter the product name");
  48. String pname=temp.next();
  49. description.setProductName(pname);
  50. System.out.println("Enter the supplier name");
  51. String sname=temp.next();
  52. description.setSupplierName(sname);
  53. System.out.println("Product Id is "+ description.getId());
  54. System.out.println("Product Name is "+ description.getProductName());
  55. System.out.println("Supplier Name is "+ description.getSupplierName());
  56. }
  57. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:42: error: cannot find symbol
        Product description=new Product();
        ^
  symbol:   class Product
  location: class Main
Main.java:42: error: cannot find symbol
        Product description=new Product();
                                ^
  symbol:   class Product
  location: class Main
2 errors
stdout
Standard output is empty