Professional Documents
Culture Documents
19CSE204 Object Oriented Programming Lab Notes: From C To Java
19CSE204 Object Oriented Programming Lab Notes: From C To Java
From C to Java
Nalinadevi Kadiresan
CSE Dept.
Amrita School of Engg.
19CSE204 Object oriented Programming 2
About Java
• A programming language.
– As defined by Gosling, Joy, and Steele in the
Java Language Specification
• A platform
– A virtual machine (JVM) definition.
– Runtime environments in diverse hardware.
• A class library
– Standard APIs for GUI, data storage,
processing, I/O, and networking.
June 2021 Nalinadevi Kadiresan
19CSE204 Object oriented Programming
3
June 2021
19CSE204 Object oriented Programming 4
javac HelloWorld.java
HelloWorld.java
compile
source code
HelloWorld.class
bytecode
java HelloWorld
run
June 2021 Nalinadevi Kadiresan
19CSE204 Object oriented Programming 7
Conditional operators
Problem 1
• Three friends named Ram, Krish and Sam go to a
baker to buy some chocolates, cakes and
sandwiches. What is the amount paid by each
one of them?
(Note: The unit price of the items are fixed)
C program
Java program
Note for Java code: write the program inside main method