Once upon a time I knew Java

After a long time working in Java. Started with the basic Java. Encapsulation, polymorphism, overloading, overriding blah blah blah. So write a small code without anyone’s help.

It takes the item details (item name, item price, item bar-code) from the user and prints the same in the console. Have a look.


package item;

public class ItemDetails
public static void main(String[] args)
/*Input Data*/
inputreader read = new inputreader();
itemproperties itemprop = new itemproperties();

System.out.println ("INPUT");

System.out.print("Enter Item Name : ");
System.out.print("Enter Item Price : ");
System.out.print("Enter Item Barcode : ");

/*Output Data*/
System.out.println ("OUTPUT");
System.out.println("Item Name : " +itemprop.getItemName());
System.out.println("Item Price : " +itemprop.getItemPrice());
System.out.println("Item Barcode : " +itemprop.getItemBarcode());


package item;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class inputReader
public String getInputDetails()
String temp = null;
BufferedReader dataIn = new BufferedReader
(new InputStreamReader(System.in));

temp = dataIn.readLine();
catch( IOException e )
System.out.println("Error in getting Input");

return temp;




package item;

public class itemProperties
String itemName;
int itemPrice;
String itemBarcode;

/*Getter and Setter method*/

public String getItemName() {
return itemName;
public void setItemName(String itemName) {
this.itemName = itemName;
public int getItemPrice() {
return itemPrice;
public void setItemPrice(int itemPrice) {
this.itemPrice = itemPrice;
public String getItemBarcode() {
return itemBarcode;
public void setItemBarcode(String itemBarcode) {
this.itemBarcode = itemBarcode;

Tried In eclipse environment

eclipse java

After a long time not bad at all huh. What you say?


Published by


I am software engineer by profession. Sometimes i post some topics about technology and some other topics which i find out interesting. My hobbies include watching movies,music, reading books(both technical and story books(fiction only)).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s