Professional Documents
Culture Documents
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.
javac HelloWorld.java
HelloWorld.java
compile
source code
HelloWorld.class
bytecode
java HelloWorld
run
June 2021 Nalinadevi Kadiresan
19CSE204 Object oriented Programming 7
• Primitive : Boolean
• Non-primitive : String, classes, interfaces
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