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

How to find Min/Max numbers in a java array?

How to find Min/Max numbers in a Java array? 
Answered on 3rd Jan, 2018, 0 Views

You can find the minimum and maximum values of an array using for loops: Live Demo , ,

How to count Java comments of a program that is stored in a text file?

How to count Java comments of a program that is stored in a text file?
Answered on 2nd Jan, 2018, 0 Views

You can read the contents of a file using the Scanner class and You can find the comments in a particular line using contains() method. , Contents of the file HelloWorld − , Output ,

Is array a primitive data type in Java?

Is array a primitive data type in Java?
Answered on 2nd Jan, 2018, 0 Views

No, arrays are not primitive datatypes in Java. They are container objects which are created dynamically. All methods of class Object may be invoked on an array. They were considered as reference data types.

Can you use both this() and super() in a constructor in Java?

Can you use both this() and super() in a constructor in Java?
Answered on 31st Dec, 2017, 0 Views

No, you cannot have both this() and super() in a single constructor.

What are lambda expressions and how to use them in Java?

What are lambda expressions and how to use them in Java?
Answered on 31st Dec, 2017, 0 Views

Lambda expressions are introduced in Java 8. These are used primarily to define inline implementation of a functional interface, i.e., an interface with a single method only. Lambda expression eliminates the need of anonymous class and gives a very simple yet powerful functional programming capability to Java. , Live Demo , ,

Can private methods of a class be accessed from outside of a class in Java?

Can private methods of a class be accessed from outside of a class in Java?
Answered on 31st Dec, 2017, 0 Views

You can access the private methods of a class using java reflection package. Step1: Instantiate the Method class of the java.lang.reflect package by passing the method name of the method which is declared private. Step2: Set the method accessible by passing value true to the setAccessible() method. Step3: Finally, invoke the method using the invoke() method. Example: ,

What is Java Generics?

What is Java Generics?
Answered on 29th Dec, 2017, 0 Views

Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively. Generics also provide compile-time type safety that allows programmers to catch invalid types at compile time.

What is dynamic binding in Java?

What is dynamic binding in Java?
Answered on 29th Dec, 2017, 0 Views

In dynamic binding, the method call is bonded to the method body at runtime. This is also known as late binding. This is done using instance methods. Example: , Output: ,

What are native methods in Java and where are they used?

What are native methods in Java and where are they used? 
Answered on 29th Dec, 2017, 0 Views

A native method in Java is a method whose implementation is written in other languages such as c and c++. The ‘native’ keyword is used before a method to indicate that it is implemented in other language.

How to execute a static block without main method in Java?

How to execute a static block without main method in Java?
Answered on 28th Dec, 2017, 0 Views

VM first looks for the main method (at least the latest versions) and then, starts executing the program including static block. Therefore, you cannot execute a static block without main method. , Since the above program doesn’t have a main method, If you compile and execute it you will get an error message. , If you want to execute static block you need to have Main method and, .....

loader
Advertisements
Contribution

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