Posts

Showing posts with the label Java

Java Interview Questions

  Java Interview Questions 1. What are the differences between C++ and Java? C++ is not platform-independent; the principle behind C++ programming is “write once, compile anywhere.” In contrast, because the byte code generated by the Java compiler is platform-independent, it can run on any machine, Java programs are written once and run everywhere. ·         Languages Compatibility. C++ is a programming language that is based on the C programming language . Most other high-level languages are compatible with C++. Most of the languages of Java are incompatible. Java is comparable to those of C and C++. ·         Interaction with the library. It can access the native system libraries directly in C++. As a result, it’s better for programming at the system level. Java’s native libraries do not provide direct call support. You can use Java Native Interface or access the libraries. ·         Characteristics. C++ distinguishes it...

Top 50 Java Programming Interview Questions

  Top 50 Java Programming Interview Questions Table of contents 1. How do you reverse a string in Java? 2 2. How do you swap two numbers without using a third variable in Java? 3 3. Write a Java program to check if a vowel is present in a string. 4 4. Write a Java program to check if the given number is a prime number. 4 5. Write a Java program to print a Fibonacci sequence using recursion. 5 6. How do you check if a list of integers contains only odd numbers in Java? 7 7. How do you check whether a string is a palindrome in Java? 8 8. How do you remove spaces from a string in Java? 8 9. How do you remove leading and trailing spaces from a string in Java? 9 10. How do you sort an array in Java? 10 11. How do you create a deadlock scenario programmatically in Java? 10 12. How can you find the factorial of an integer in Java? 12 13. How do you reverse a linked list in Java? 12 14. How do you implement a binary search in Java? 13 15. Write a Java program ...