Character Stream : It provides a convenient means for handling input and output of characters.

Similar documents
Answer1. Features of Java

Lecture 11.1 I/O Streams

1 Shyam sir JAVA Notes

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

B.V. Patel Institute of BMC & IT, UTU 2014

Sri Vidya College of Engineering & Technology Question Bank

Experiment No: Group B_4

CS11 Java. Fall Lecture 1

C++ Important Questions with Answers

Introduction to Programming Using Java (98-388)

Byte and Character Streams. Reading and Writing Console input and output

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

Class, Variable, Constructor, Object, Method Questions

I/O streams. Byte Streams Character Streams InputStream ByteArrayInputStream FileInputStream FilterInputStream

OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70

Java Primer 1: Types, Classes and Operators

File IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA

CS/B.TECH/CSE(OLD)/SEM-6/CS-605/2012 OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

15CS45 : OBJECT ORIENTED CONCEPTS

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

CS260 Intro to Java & Android 03.Java Language Basics

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Chapter 1 Getting Started

VALLIAMMAI ENGINEERING COLLEGE

WOSO Source Code (Java)

Object Oriented Programming with c++ Question Bank

Programming. Syntax and Semantics

3. Java - Language Constructs I

Chapter 5 Object-Oriented Programming

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

Short Notes of CS201

20 Most Important Java Programming Interview Questions. Powered by

COT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748

13 th Windsor Regional Secondary School Computer Programming Competition

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

CS201 - Introduction to Programming Glossary By

Data Types, Variables and Arrays. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Java Overview An introduction to the Java Programming Language

File Operations in Java. File handling in java enables to read data from and write data to files

1/16/2013. Program Structure. Language Basics. Selection/Iteration Statements. Useful Java Classes. Text/File Input and Output.

The Java programming environment. The Java programming environment. Java: A tiny intro. Java features

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result.

Question. 1 Features of Java.

What are the characteristics of Object Oriented programming language?

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

CSE 431S Type Checking. Washington University Spring 2013

Programming Languages and Techniques (CIS120)

COP 3330 Final Exam Review

Darshan Institute of Engineering & Technology for Diploma Studies

Computational Expression

CS 231 Data Structures and Algorithms, Fall 2016

09-1. CSE 143 Java GREAT IDEAS IN COMPUTER SCIENCE. Overview. Data Representation. Representation of Primitive Java Types. Input and Output.

C# MOCK TEST C# MOCK TEST II

Zheng-Liang Lu Java Programming 45 / 79

JAVA Programming Fundamentals

Constants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous

Kickstart Intro to Java Part I

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Simple Java Programs. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

CIS133J. Working with Numbers in Java

Programming Language Concepts: Lecture 2

XII- COMPUTER SCIENCE VOL-II MODEL TEST I

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI


Tools : The Java Compiler. The Java Interpreter. The Java Debugger

CS 11 java track: lecture 1

Files and IO, Streams. JAVA Standard Edition

Tirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax

Programming Language Concepts: Lecture 2

C Language Advanced Concepts. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Computers Programming Course 5. Iulian Năstac

Object Oriented Programming with Java. Unit-1

Expressions & Flow Control

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

c-lambda: C FFI via raco ctool

Java in 21 minutes. Hello world. hello world. exceptions. basic data types. constructors. classes & objects I/O. program structure.

NOOTAN PADIA ASSIST. PROF. MEFGI, RAJKOT.

Name of subject: JAVA PROGRAMMING Subject code: Semester: V ASSIGNMENT 1

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Chapter 1 Introduction to Java

LECTURE 2 (Gaya College of Engineering)

An overview of Java, Data types and variables

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

Week 12. Streams and File I/O. Overview of Streams and File I/O Text File I/O

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

Java Identifiers, Data Types & Variables

Java Input/Output. 11 April 2013 OSU CSE 1

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING

1993: renamed "Java"; use in a browser instead of a microwave : Sun sues Microsoft multiple times over Java

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

Transcription:

Be Perfect, Do Perfect, Live Perfect 1 1. What is the meaning of public static void main(string args[])? public keyword is an access modifier which represents visibility, it means it is visible to all. static is a keyword, if we declare any method as static, it is known as static method. The core advantage of static method is that there is no need to create object to invoke the static method. The main method is executed by the JVM, so it doesn't require to create object to invoke the main method. So it saves memory. void is the return type of the method, it means it doesn't return any value. main represents startup of the program. String[] args is used for command line argument. 2. What is a Stream? List different types of streams in Java. A Stream is linked to a physical layer by java I/O system to make input and output operation in java. A stream can be defined as a sequence of data. Java a stream is composed of bytes. It's called a stream because it's like a stream of water that continues to flow Java encapsulates Stream under java.io package. Java defines two types of streams. They are, Byte Stream: It provides a convenient means for handling input and output of byte. Character Stream : It provides a convenient means for handling input and output of characters. Byte Stream Classes Byte stream is defined by using two abstract class at the top of hierarchy, they are InputStream and OutputStream. OutputStream Java application uses an output stream to write data to a destination, it may be a file,an array,peripheral device or socket. InputStream Java application uses an input stream to read data from a source, it may be a file,an array,peripheral device or socket.

Be Perfect, Do Perfect, Live Perfect 2 3. Explain predefine streams in Java? Standard Input This is used to feed the data to user's program and usually a keyboard is used as standard input stream and represented as System.in. Standard Output This is used to output the data produced by the user's program and usually a computer screen is used for standard output stream and represented as System.out. Standard Error This is used to output the error data produced by the user's program and usually a computer screen is used for standard error stream and represented as System.err. 4. Differentiate byte and character streams. Byte streams can read or write the files containing ASCII characters that range from 0 to 255. That is, byte streams can copy the files containing English letters only but not of other languages. Character streams operate on Unicode characters. That is, character streams can read, write and copy the files containing other than English characters. Characters streams can do with English characters also as ASCII code is a subset of Unicode. 5. What is infinite loop in Java? The loop that never terminates is called as infinite loops. Syntax: for(;;)

Be Perfect, Do Perfect, Live Perfect 3 6. What is type conversion? Explain its types. Assigning a value of one type to a variable of another type is known as Type Casting. Automatic type conversion Automatic Type casting take place by JVM automatically. Example : public class Test public static void main(string[] args) int i = 100; long l = i; //no explicit type casting required float f = l; //no explicit type casting required System.out.println("Int value "+i); System.out.println("Long value "+l); System.out.println("Float value "+f); Output : Int value 100 Long value 100 Float value 100.0 Explicit type conversion When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting. public class Test public static void main(string[] args) double d = 100.04; long l = (long)d; //explicit type casting required int i = (int)l; //explicit type casting required

Be Perfect, Do Perfect, Live Perfect 4 System.out.println("Double value "+d); System.out.println("Long value "+l); System.out.println("Int value "+i); Output : Double value 100.04 Long value 100 Int value 100 7. Difference between C++ and Java? Platformindependent Mainly used for C++ is platformdependent. C++ is mainly used for system programming. Java is platform-independent. Java is mainly used for application programming. It is widely used in window, web-based, enterprise and mobile applications. Goto C++ supports goto statement. Java doesn't support goto statement. Multiple inheritance Operator Overloading Pointers Compiler and Interpreter C++ supports multiple inheritance. C++ supports operator overloading. C++ supports pointers. You can write pointer program in C++. C++ uses compiler only. Java doesn't support multiple inheritance through class. It can be achieved by interfaces in java. Java doesn't support operator overloading. Java supports pointer internally. But you can't write the pointer program in java. It means java has restricted pointer support in java. Java uses compiler and interpreter both.

Be Perfect, Do Perfect, Live Perfect 5 Call by Value and Call by reference Structure and Union Thread Support Documentation comment Virtual Keyword unsigned right shift >>> Inheritance Tree C++ supports both call by value and call by reference. C++ supports structures and unions. C++ doesn't have built-in support for threads. It relies on third-party libraries for thread support. C++ doesn't support documentation comment. C++ supports virtual keyword so that we can decide whether or not override a function. C++ doesn't support >>> operator. C++ creates a new inheritance tree always. Java supports call by value only. There is no call by reference in java. Java doesn't support structures and unions. Java has built-in thread support. Java supports documentation comment (/**... */) to create documentation for java source code. Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default. Java supports unsigned right shift >>> operator that fills zero at the top for the negative numbers. For positive numbers, it works same like >> operator. Java uses single inheritance tree always because all classes are the child of Object class in java. Object class is the root of inheritance tree in java. Note: Kindly read the given first unit notes and refer the previous year question bank.