Ch1 Program's Jav
Ch1 Program's Jav
Ch1 Program's Jav
import java.util.Scanner;
// String input
System.out.println("Enter name");
System.out.println("Enter gender");
// Character input
System.out.println("Enter age");
// correctly obtained.
-------
Prg 2
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
String name;
int id = Integer.parseInt(reader.readLine());
System.out.println("Name: "+name);
System.out.println("Age: "+age);
System.out.println("Id: "+id);
-------
Prg 3
args[i]);
-----
Prg 4
{
public static void main(String[] args) {
/*System.out.println(sc.next());
System.out.println(sc.next());
System.out.println(sc.next());
System.out.println(sc.next());*/
System.out.println(sc.nextLine());
System.out.println(sc.nextLine());
Prg 5
class Box
double width;
double height;
double depth;
class Main {
mybox.width = 10;
mybox.height = 20;
mybox.depth = 15;
class Box {
double width;
double height;
double depth;
class Main{
double vol;
mybox1.width = 10;
mybox1.height = 20;
mybox1.depth = 15;
mybox2.width = 3;
mybox2.height = 6;
mybox2.depth = 9;
Prg 7
class Box {
double width;
double height;
double depth;
class Main{
double vol;
mybox1.width = 10;
mybox1.height = 20;
mybox1.depth = 15;
instance variables */
mybox2.width = 3;
mybox2.height = 6;
mybox2.depth = 9;