007-001-005
Basic Class Creation: Product Information
Easy
Problem Description
Basic Class Creation: Product Information
Learning Objective: Understand basic class creation and field declaration
Overview
Create a Product class with name and price, then output the product information.
Specifications
- Create a Product class
- name field (String type)
- price field (int type)
- Create a Product object in main method, set values and output
Input
No input
Output Format
Product: Apple
Price: 150
Test Cases
※ Output examples follow programming industry standards
Input:
Expected Output:
Product: Apple Price: 150
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
