Showing posts with label History of Java. Show all posts
Showing posts with label History of Java. Show all posts

Monday, 29 March 2021

Methods in JAVA Language

 In general, a way may be thanks to perform some task. Similarly, the tactic in Java may be a collection of instructions that performs a selected task. It provides the reusability of code. we will also easily modify code using methods. during this section, we'll learn what's a way in Java, sorts of methods, method declaration, and the way to call a way in Java.


What is Method in JAVA language? 

A method may be a block of code or collection of statements or a group of code grouped together to perform a particular task or operation. It is wont to achieve the reusability of code. We can write a method once and use it many times. We don't require to write down code again and again. It also provides the straightforward modification and readability of code, just by adding or removing a piece of code. The method is executed only we call or invoke it.
The most important method in Java is that the main() method.


Method Declaration in JAVA. 

The method declaration provides information about method attributes, like visibility, return-type, name, and arguments. It has six components that are known as method header, as we have shown in the following figure.



Method Signature: Every method has a method signature. It is a part of the method declaration. It includes the method name and parameter list.

Access Specifier: Access specifier or modifier is that the access sort of the tactic. It specifies the visibility of the method. Java provides four types of access specifier:

Public: The method is accessible by all classes when we use public specifier in our application.

Private: once we use a personal access specifier, the tactic is accessible only within the classes during which it's defined.

Protected: once we use protected access specifier, the tactic is accessible within an equivalent package or subclasses during a different package.

Default: once we don't use any access specifier within the method declaration, Java uses default access specifier by default. It is visible only from an equivalent package only.

Return Type: Return type may be a data type that the tactic returns. It may have a primitive data type, object, collection, void, etc. If the tactic doesn't return anything, we use void keyword.

Method Name: it's a singular name that's wont to define the name of a way . It must be like the functionality of the tactic . Suppose, if we are creating a way for subtraction of two numbers, the tactic name must be subtraction(). A method is invoked by its name.

Parameter List: it's the list of parameters separated by a comma and enclosed within the pair of parentheses. It contains the data type and variable name. If the method has no parameter, left the parentheses blank.

Method Body: It is a part of the method declaration. It contains all the actions to be performed. It is enclosed within the pair of curly braces.

Tuesday, 8 November 2016

History of Java Language

Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank and Mike Sheridan at Sun Microsystem, Inc. in 1991. It took 18 months to develop the first working version. This language was initially called "Oak" but was renamed "JAVA" in 1995. Java generated immediate interested in Business community because of the phenomenal interest in World Wide Web. Java is now used in create Web pages with dynamic and interactive content, to develop large-scale enterprise applications to enhance the functionality of World Wide Web server, to provide applications for consumer device.

Why Java is important to the  Internet: 

The Internet helped catapult Java to the forefront of the programming, and Java, in turn,  has had a profound effect on the Internet. The reason for this is quite simple: Java expands the universe of the objects that can move  about freely in cyberspace. In a network, two very broad categories of objects are transmitted between the server and your personal computer passive information and dynamic, active program, For example, when you read your e-mail, you are viewing passive data. Even when you download a program the program's code is still only passive data until you execute it. However, a second type of object can be transmitted to your computer: a dynamic, self-executing program. Such a program is an active agent on the client computer, yet is initiated by  the server. For example, a program might be provided by the server to display properly the data that the server is sending.

As desirable as dynamic, networked programs are, they also present serious problems in the areas of security and portability. prior to Java, cyberspace was effectively closed to half the entities that now live there. Java addresses those concerns and by doing so has opened the door to an exciting new form of program: the applet.

Methods in JAVA Language

 In general, a way may be thanks to perform some task. Similarly, the tactic in Java may be a collection of instructions that performs a sel...