Java Reference
In-Depth Information
// Use List for String type
List<String> sList = new ArrayList<String>();
sList.add("string 1");
sList.add("string 2");
String s2 = sList.get(1);
// Use List for Integer type
List<Integer> iList = new ArrayList<Integer>();
iList.add(10);
iList.add(20);
int i2 = iList.get(1);
Summary
Writing the set of instructions for a computer to accomplish a task is known as programming. The set of instructions is
known as a program. Different types of programming languages exist. They differ in their closeness to the instructions
that the hardware can understand or the paradigm. A machine language lets you write programs using 0s and 1s,
and it is the lowest level programming language. A program written in machine language is known as machine code.
An assembly language lets you write programs using mnemonics. A program written using an assembly language is
known as assembly code. Later, higher-level programming languages were developed, using an English-like language.
Several types of programming paradigms are in practice. A programming paradigm is a thinking cap for viewing
and analyzing real-world problems in a particular way. Imperative, procedural, functional, and object-oriented are
some widely used paradigms in software development. Java is a programming language that supports procedural,
functional, and object-oriented programming paradigms.
Abstraction, encapsulation, inheritance, and polymorphism are the four pillars of object-oriented paradigms.
Abstraction is the process of hiding details of a program that are irrelevant to the users. Encapsulation is the process
of bundling multiple items into one entity. Inheritance is the process of arranging classes in a hierarchical manner to
build supertype/subtype relationships. Inheritance promotes reusability of code by allowing programmers to write
the code in terms of a supertype that also works for all of the subtypes. Polymorphism is the way of writing a piece of
code once that can operate on multiple types. Method overloading, method overriding, subtyping, and generics are
some of the ways to implement polymorphism.
 
Search WWH ::




Custom Search