- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 477 Articles for Java8
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Updated on 08-Apr-2020 14:09:28
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and the existing method by name in a lambda expression. In addition to the instance and static methods, you can also refer a constructor by using the new keyword.SyntaxFollowing is the syntax to reference a constructor in Java.ClassName::newExampleinterface myInterface{ Test greet(String data); } class Test{ Test(String data){ System.out.println(data); } } public class MethodReferences { public static void ... Read More ![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Updated on 08-Apr-2020 14:08:37
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and existing method by name in a lambda expression.SyntaxFollowing is the syntax to reference a instance method in JavaObject:methodNameExampleFollowing Java example references a instance method in Java.interface myInterface{ void greet(); } public class MethodReferences { public static void demo() { System.out.println("Sample method"); } public static void main(String args[]) { MethodReferences obj = new MethodReferences(); ... Read More ![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Updated on 08-Apr-2020 14:07:14
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and the existing method by name in a lambda expression.SyntaxObject:methodNameExampleSuppose, if we have an interface named myInterface, we can pass the functionality/implementation as object value as shown below −interface myInterface{ void greet(); } public class MethodReferences { public static void main(String args[]) { myInterface in = ()->System.out.println("Sample method");; in.greet(); } }If we already have an implementation ... Read More ![Vikyath Ram](https://www.tutorialspoint.com/assets/profiles/13780/profile/60_74413-1512648006.jpg)
Updated on 30-Jul-2019 22:30:26
This method retrieves the list of all the SQL keywords of the underlying database and returns in the form of a String variable which holds all the keywords separated by commas.To get the list of keywords in the database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user name, password of a user in the database, as String variables.Get the DatabaseMetaData ... Read More ![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Updated on 30-Jul-2019 22:30:25
Actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.There is only one syntax for the Action element, as it conforms to the XML standard −Action elements are basically predefined functions. The following table lists out the available JSP actions −S.No.Syntax & Purpose1jsp:includeIncludes a file at the time the page is requested.2jsp:useBeanFinds or instantiates a JavaBean.3jsp:setPropertySets the property of a JavaBean.4jsp:getPropertyInserts the property of a JavaBean into the output.5jsp:forwardForwards the requester to a new ... Read More ![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Updated on 30-Jul-2019 22:30:25
The getValueX() method is used to get a value from Pair Tuple class in Java at a particular index. For example, getValue0().Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Pair Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Pair; public class Demo { ... Read More ![Amit Diwan](https://www.tutorialspoint.com/assets/profiles/12232/profile/60_57779-1530512459.jpg)
Updated on 30-Jun-2020 12:13:33
Tuples in Java are an ordered collection of objects of different types. To run Tuple in Java, you need to upload an external jar file. Here, we will be using Eclipse IDE to create a new Java Project and upload the JavaTuples external jar file.The JavaTuples jar file is to be downloaded. Let us first download the jar file, create an Eclipse project and import the downloaded jar file. Here are the steps −Step 1 − Download JavaTuples Jar library and save it on your system.Open the GitHib link and download the “javatuples-1.2-dist.zip” as shown below −After downloading, unzip and ... Read More ![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Updated on 30-Jul-2019 22:30:23
There are five main memory areas which are used to various Java elements. Following is the list of the same.
Class Area - This area contains the static members of the class.
Method Area - This area contains the method definition and executable code.
Heap Area - This area contains the objects which are dynamically allocated/deallocated. if an object is no more referenced by any live reference it is deallocated.
Stack Area - This area contains the local variables.
Pool Area - Contains immutable objects like string.
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Updated on 23-Jun-2020 15:30:10
The volatile modifier is used to let the JVM know that a thread accessing the variable must always merge its own private copy of the variable with the master copy in the memory.Accessing a volatile variable synchronizes all the cached copied of the variables in the main memory. Volatile can only be applied to instance variables, which are of type object or private. A volatile object reference can be null.Examplepublic class MyRunnable implements Runnable {
private volatile boolean active;
public void run() {
active = true;
while (active) {
}
}
public void stop() {
active = false;
}
} ![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
Updated on 23-Jun-2020 15:20:56
Public Access Modifier - PublicA class, method, constructor, interface, etc. declared public can be accessed from any other class. Therefore, fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe.However, if the public class we are trying to access is in a different package, then the public class still needs to be imported. Because of class inheritance, all public methods and variables of a class are inherited by its subclasses.ExampleThe following function uses public access control −public static void main(String[] arguments) { // ... }The main() method of an application ... Read More Advertisements