Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

Find max and min values in an array of primitives using Java

Answered on 14th Aug, 2018, 0 Views

This example shows how to search the minimum and maximum element in an array by using Collection.max() and Collection.min() methods of Collection class. , The above code sample will produce the following result. , Another sample example of the minimum and the maximum element in an array. , The above code sample will produce the following result. ,

final variables in Java

Answered on 14th Aug, 2018, 0 Views

A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to an different object. However, the data within the object can be changed. So, the state of the object can be changed but not the reference. With variables, the final modifier often is used with static to make the constant a class variable. , Compiler will t.....

Executable Comments in Java

Answered on 13th Aug, 2018, 0 Views

As we all know, that java compiler ignores the comments written in the java code file. But using a trick we can execute the code present in a comment section. Consider the following program − , This will produce the following result − , The reason behind this behaviour is the use of \u000d character in comment which is a new line character. As Java compiler parses the new .....

Evolution of interfaces in Java

Answered on 13th Aug, 2018, 0 Views

Prior to java 8, interfaces can have following type of variables/methods. Constant variables Abstract methods So we cannot have method implementation in interfaces or more precisely a default implementation prior to Java 8. See the example. , You will see the following output. , In above example, each log method has its own implementation. With Java 8 interfaces can have following ty.....

Different ways to create Objects in Java

Answered on 13th Aug, 2018, 0 Views

Following are the different ways to create objects in Java. Using new keyword − Mostly used method. Call any constructor with new keyword to create an object. , Using Class.forName().newInstance() − Load the class using Class.forName() and then call its newInstance() method to create the object. , Using clone() method − Get the clone object of the required object by.....

Difference between HashMap and ConcurrentHashMap in Java

Answered on 13th Aug, 2018, 0 Views

Following are the notable differences between HashMap and ConcurrentHashMap classes in Java.   HashMap ConcurrentHashMap Synchronized HashMap is not synchronized. ConcurrentHashMap is synchronized. Thread Safe HashMap is not thread safe. ConcurrentHashMap is thread safe. Iterator type HashMap iterator is fail-fast and ArrayList throws ConcurrentModificationException if concurrent modi.....

Counting number of words in text file using java

Answered on 13th Aug, 2018, 0 Views

We can read words in a file using BufferedReader class of Java and splitting the read data based on space character. See the example below: Consider the following text file in classpath. , , This will produce the following result − ,

Examples of Existing Networks

Answered on 13th Jul, 2018, 0 Views

Some of the prominently used networks in today’s world are: InternetIEEE 802.11 for Wireless LANRFID and Sensor NetworksInternet is a global collection of vast number of dissimilar networks that are interconnected together. Internet uses the TCP/IP protocol and provides varied services. The networks forming the Internet may be private, public, academic, commercial or government, but I.....

The Host-to-Network Layer in TCP/IP Model

Answered on 13th Jul, 2018, 0 Views

The host-to-network layer is the lowest layer of the TCP/IP model and is concerned with the physical transmission of data. It is also called a network interface layer or link layer. It can be considered as the combination of physical layer and data link layer of the OSI model. The functions of this layer are: It defines how bits are to be encoded into optical or electrical pulses.It accepts.....

The Physical Layer of OSI Model

Answered on 13th Jul, 2018, 0 Views

The physical layer (Layer 1) deals with transmission of individual bits from one node to another over a physical medium. The main functions of the physical layer are as follows: It defines the physical characteristics and functions of the physical devices and interfaces so that transmission can occur. It states the number of pins in each of the devices as well as the purpose of each pin.It .....

Previous 1 ... 4 5 6 7 8 9 10 ... 16 Next
loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.