SlideShare a Scribd company logo
1 of 4
(Cover pg)
ASSIGNMENT- FALL 2013
Name:

__Narinder Kumar_________________________

Registration No:

__511225739_____________________________

Learning Center:

__Artex Informatic_________________________

Learning Center Code:

__1688__________________________________

Course:

__MCA__________________________________

Subject:

__ JAVA PROGRAMMING__________________

Semester:

___IV___________________________________

Subject Code:

___MC0078______________________________

Date of submission:

___30 November 2013______________________

Marks awarded:

________________________________________

Directorate of Distance Education
Sikkim Manipal University
II Floor, Syndicate House
Manipal – 576 104

Signature of Coordinator

Signature of Center

Q1:- List ten features of JAVA

Signature of Evaluator
Ans:- Features of Java:

1) Java is a simple language that can be learned easily, even if you have just
started programming.
2) A Java programmer need not know the internal of Java. The syntax of Java is
similar to C++. Unlike C++, in which the programmer handles memory
manipulation, Java handles the required memory manipulations, and thus
prevents errors that arise due to improper memory usage.
3) Java defines data as objects with methods that support the objects. Java is
purely object-oriented and provides abstraction, encapsulation, inheritance and
polymorphism. Even the most basic program has a class. Any code that you
write in Java is inside a class.
4) Java is tuned of Web. Java programs can access data across the Web as easily
as they access data from a local system.
5) Java is both interpreted and compiled. The code is compiled to a byte code
that is binary and platform independent.
6) When you compile a piece of code, all the errors is listed together. You can
execute only when all the errors are rectified. An interpreter, on the other
hand, verifies the code and executes it line by line.
7) Compilation is the process of converting the code that you type, into a
language that the computer understands- machine language. When you
compile a program using a compiler, the compiler checks for syntactic errors
in code and list all the errors on the screen.
8) Byte code is the result of compiling a Java program. You can execute this
code on any platform. In other words, due to the byte code compilation
process and interpretation by a browser, Java programs can be executed on a
variety of hardware and operating systems. The only requirement is that the
system should have a Java-enabled Internet browser.
9) Java forces you to handle unexpected errors. This ensures that Java programs
are robust (reliable), and bug free and do not crash.
10) You can create multithreading programs using Java. The core of Java is also
multithreaded.
Q2:- Write short notes on packages and Interfaces in JAVA
Ans:- Packages: In the preceding section, the name of each example class was taken

from the same name space. This means that a unique name had to be used for each
class to avoid name collisions. After a while, without some way to manage the name
space, you could run out of convenient, descriptive names for individual classes. You
also need some way to be assured that the name you choose for a class will be
reasonably unique and not collide with class names chosen by other programmers.
Thankfully, Java provides a mechanism for partitioning the class name space into
more manageable chunks. This mechanism is the package. The package is both a
naming and a visibility control mechanism. You can define classes inside a package
that are not accessible by code outside that package. You can also define class
members that are only exposed to other members of the same package. This allows
your classes to have intimate knowledge of each other, but not expose that knowledge
to the rest of the world.
Interface: Using the keyword interface, you can fully abstract a class' interface from
its implementation. That is, using interface, you can specify what a class must do, but
not how it does it. Interfaces are syntactically similar to classes, but they lack instance
variables, and their methods are declared without any body. In practice, this means
that you can define interfaces which don't make assumptions about how they are
implemented. Once it is defined, any number of classes can implement an interface.
Also, one class can implement any number of interfaces. To implement an interface, a
class must create the complete set of methods defined by the interface. However, each
class is free to determine the details of its own implementation. By providing the
interface keyword, Java allows you to fully utilize the "one interface, multiple
methods" aspect of polymorphism.
Q3:- What is the difference between errors and exceptions? What are
the different types of Exception?
Ans:- Definition of an Exception: The term exception denotes an exceptional event. It

can be defined as an abnormal event that occurs during program execution and
disrupts the normal flow of instruction.
Error-handling becomes a necessity when you develop applications that need to take
care of unexpected situations.
If an above-mentioned situation is encountered, a program may stop working. You
cannot afford to have an application stop working or crashing, if the requested file is
not present on the disk.
Exception Classes:
Common Exceptions

Java has several predefined exceptions. The most common exceptions that you may
encounter are described below.
� Arithmetic Exception

This exception is thrown when an exceptional arithmetic condition has occurred. For
example, a division by zero generates such an exception.
� Null Pointer Exception

This exception is thrown when an application attempts to use null where an object is
required. An object that has not been allocated memory holds a null value. The
situations in which an exception is thrown include:
a) Using an object without allocating memory for it.
b) Calling the methods of a null object.
c) Accessing or modifying the attributes of a null object.
� ArrayIndexOutOfBounds Exception

The exception ArrayIndexOutOfBounds Exception is thrown when an attempt is
made to access an array element beyond the index of the array. For example, if you
try to access the eleventh element of an array that’s has only ten elements, the
exception will be thrown.
Q4:- What are the differences between a process and a thread?
Ans:- Processes and Threads: In concurrent programming, there are two basic units of

execution: processes and threads. In the Java programming language, concurrent
programming is mostly concerned with threads. However, processes are also
important.
A computer system normally has many active processes and threads. This is true even
in systems that only have a single execution core, and thus only have one thread
actually executing at any given moment. Processing time for a single core is shared
among processes and threads through an OS feature called time slicing.
Processes: A process has a self-contained execution environment. A process generally

has a complete, private set of basic run-time resources; in particular, each process has
its own memory space.
Processes are often seen as synonymous with programs or applications. However,
what the user sees as a single application may in fact be a set of cooperating
processes. To facilitate communication between processes, most operating systems
support Inter Process Communication (IPC) resources, such as pipes and sockets.
Threads: Threads are sometimes called lightweight processes. Both processes and

threads provide an execution environment, but creating a new thread requires fewer
resources than creating a new process.
Threads exist within a process every process has at least one. Threads share the
process's resources, including memory and open files. This makes for efficient, but
potentially problematic, communication.
Q5:- a) Write Java program to print the address of the study center.
b) Write a Java program to find the sum of 1+3+5+…. for 10
terms in the series.
Ans:- a) Write Java program to print the address of the study center.

More Related Content

What's hot

Introduction to java
Introduction to javaIntroduction to java
Introduction to javaAli Baba
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJavabynataraJ
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answerskavinilavuG
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introductionRamlal Pawar
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfnofakeNews
 
Bca 4020 java programming
Bca 4020   java programmingBca 4020   java programming
Bca 4020 java programmingsmumbahelp
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interviewKuntal Bhowmick
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questionssatish reddy
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview QuestionsEhtisham Ali
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-pptMayank Kumar
 
Java Presentation
Java PresentationJava Presentation
Java Presentationpm2214
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSujit Majety
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpointravi tyagi
 
MS.Net Interview Questions - Simplified
MS.Net Interview Questions - SimplifiedMS.Net Interview Questions - Simplified
MS.Net Interview Questions - SimplifiedMohd Manzoor Ahmed
 

What's hot (19)

Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java notes
Java notesJava notes
Java notes
 
01slide
01slide01slide
01slide
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Core java-introduction
Core java-introductionCore java-introduction
Core java-introduction
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
 
Core Java
Core JavaCore Java
Core Java
 
Bca 4020 java programming
Bca 4020   java programmingBca 4020   java programming
Bca 4020 java programming
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
Android interview questions
Android interview questionsAndroid interview questions
Android interview questions
 
Java training in delhi
Java training in delhiJava training in delhi
Java training in delhi
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview Questions
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpoint
 
MS.Net Interview Questions - Simplified
MS.Net Interview Questions - SimplifiedMS.Net Interview Questions - Simplified
MS.Net Interview Questions - Simplified
 

Similar to MC0078 SMU 2013 Fall session

Library Managemnet System
Library Managemnet SystemLibrary Managemnet System
Library Managemnet SystemAbhishek Shakya
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questionsGradeup
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objectsvmadan89
 
Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Mohamed Essam
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxssuser84e52e
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using ReflectionGanesh Samarthyam
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedGaurav Maheshwari
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESsuthi
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedyearninginjava
 

Similar to MC0078 SMU 2013 Fall session (20)

Library Managemnet System
Library Managemnet SystemLibrary Managemnet System
Library Managemnet System
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
CAR SHOWROOM SYSTEM
CAR SHOWROOM SYSTEMCAR SHOWROOM SYSTEM
CAR SHOWROOM SYSTEM
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
Intro to programing with java-lecture 1
Intro to programing with java-lecture 1Intro to programing with java-lecture 1
Intro to programing with java-lecture 1
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Java notes
Java notesJava notes
Java notes
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
 
J threads-pdf
J threads-pdfJ threads-pdf
J threads-pdf
 
Basics of java 1
Basics of java 1Basics of java 1
Basics of java 1
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
 
Concurrency and parallel in .net
Concurrency and parallel in .netConcurrency and parallel in .net
Concurrency and parallel in .net
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
 
Professional-core-java-training
Professional-core-java-trainingProfessional-core-java-training
Professional-core-java-training
 

Recently uploaded

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

Recently uploaded (20)

USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

MC0078 SMU 2013 Fall session

  • 1. (Cover pg) ASSIGNMENT- FALL 2013 Name: __Narinder Kumar_________________________ Registration No: __511225739_____________________________ Learning Center: __Artex Informatic_________________________ Learning Center Code: __1688__________________________________ Course: __MCA__________________________________ Subject: __ JAVA PROGRAMMING__________________ Semester: ___IV___________________________________ Subject Code: ___MC0078______________________________ Date of submission: ___30 November 2013______________________ Marks awarded: ________________________________________ Directorate of Distance Education Sikkim Manipal University II Floor, Syndicate House Manipal – 576 104 Signature of Coordinator Signature of Center Q1:- List ten features of JAVA Signature of Evaluator
  • 2. Ans:- Features of Java: 1) Java is a simple language that can be learned easily, even if you have just started programming. 2) A Java programmer need not know the internal of Java. The syntax of Java is similar to C++. Unlike C++, in which the programmer handles memory manipulation, Java handles the required memory manipulations, and thus prevents errors that arise due to improper memory usage. 3) Java defines data as objects with methods that support the objects. Java is purely object-oriented and provides abstraction, encapsulation, inheritance and polymorphism. Even the most basic program has a class. Any code that you write in Java is inside a class. 4) Java is tuned of Web. Java programs can access data across the Web as easily as they access data from a local system. 5) Java is both interpreted and compiled. The code is compiled to a byte code that is binary and platform independent. 6) When you compile a piece of code, all the errors is listed together. You can execute only when all the errors are rectified. An interpreter, on the other hand, verifies the code and executes it line by line. 7) Compilation is the process of converting the code that you type, into a language that the computer understands- machine language. When you compile a program using a compiler, the compiler checks for syntactic errors in code and list all the errors on the screen. 8) Byte code is the result of compiling a Java program. You can execute this code on any platform. In other words, due to the byte code compilation process and interpretation by a browser, Java programs can be executed on a variety of hardware and operating systems. The only requirement is that the system should have a Java-enabled Internet browser. 9) Java forces you to handle unexpected errors. This ensures that Java programs are robust (reliable), and bug free and do not crash. 10) You can create multithreading programs using Java. The core of Java is also multithreaded. Q2:- Write short notes on packages and Interfaces in JAVA Ans:- Packages: In the preceding section, the name of each example class was taken from the same name space. This means that a unique name had to be used for each class to avoid name collisions. After a while, without some way to manage the name space, you could run out of convenient, descriptive names for individual classes. You also need some way to be assured that the name you choose for a class will be reasonably unique and not collide with class names chosen by other programmers. Thankfully, Java provides a mechanism for partitioning the class name space into more manageable chunks. This mechanism is the package. The package is both a naming and a visibility control mechanism. You can define classes inside a package that are not accessible by code outside that package. You can also define class members that are only exposed to other members of the same package. This allows your classes to have intimate knowledge of each other, but not expose that knowledge to the rest of the world. Interface: Using the keyword interface, you can fully abstract a class' interface from its implementation. That is, using interface, you can specify what a class must do, but not how it does it. Interfaces are syntactically similar to classes, but they lack instance
  • 3. variables, and their methods are declared without any body. In practice, this means that you can define interfaces which don't make assumptions about how they are implemented. Once it is defined, any number of classes can implement an interface. Also, one class can implement any number of interfaces. To implement an interface, a class must create the complete set of methods defined by the interface. However, each class is free to determine the details of its own implementation. By providing the interface keyword, Java allows you to fully utilize the "one interface, multiple methods" aspect of polymorphism. Q3:- What is the difference between errors and exceptions? What are the different types of Exception? Ans:- Definition of an Exception: The term exception denotes an exceptional event. It can be defined as an abnormal event that occurs during program execution and disrupts the normal flow of instruction. Error-handling becomes a necessity when you develop applications that need to take care of unexpected situations. If an above-mentioned situation is encountered, a program may stop working. You cannot afford to have an application stop working or crashing, if the requested file is not present on the disk. Exception Classes: Common Exceptions Java has several predefined exceptions. The most common exceptions that you may encounter are described below. � Arithmetic Exception This exception is thrown when an exceptional arithmetic condition has occurred. For example, a division by zero generates such an exception. � Null Pointer Exception This exception is thrown when an application attempts to use null where an object is required. An object that has not been allocated memory holds a null value. The situations in which an exception is thrown include: a) Using an object without allocating memory for it. b) Calling the methods of a null object. c) Accessing or modifying the attributes of a null object. � ArrayIndexOutOfBounds Exception The exception ArrayIndexOutOfBounds Exception is thrown when an attempt is made to access an array element beyond the index of the array. For example, if you try to access the eleventh element of an array that’s has only ten elements, the exception will be thrown. Q4:- What are the differences between a process and a thread? Ans:- Processes and Threads: In concurrent programming, there are two basic units of execution: processes and threads. In the Java programming language, concurrent programming is mostly concerned with threads. However, processes are also important. A computer system normally has many active processes and threads. This is true even in systems that only have a single execution core, and thus only have one thread actually executing at any given moment. Processing time for a single core is shared
  • 4. among processes and threads through an OS feature called time slicing. Processes: A process has a self-contained execution environment. A process generally has a complete, private set of basic run-time resources; in particular, each process has its own memory space. Processes are often seen as synonymous with programs or applications. However, what the user sees as a single application may in fact be a set of cooperating processes. To facilitate communication between processes, most operating systems support Inter Process Communication (IPC) resources, such as pipes and sockets. Threads: Threads are sometimes called lightweight processes. Both processes and threads provide an execution environment, but creating a new thread requires fewer resources than creating a new process. Threads exist within a process every process has at least one. Threads share the process's resources, including memory and open files. This makes for efficient, but potentially problematic, communication. Q5:- a) Write Java program to print the address of the study center. b) Write a Java program to find the sum of 1+3+5+…. for 10 terms in the series. Ans:- a) Write Java program to print the address of the study center.