One of the problems with ps command, which is a popular tool to find any processes along with the grep command in the Solaris operating system is that it doesn't show full command-line argument of process. This means if you are doing grep on any text which appears at the tail end of the long command line, you will likely not able to capture that process by using ps and grep. This is dangerous because it may lead you to assume that certain process is not running and you may restart it again, despite its being running and only because you didn't find the process.
Thursday, February 23, 2023
Thursday, February 16, 2023
How to use var keyword to declare local variables in Java? Example Tutorial
Hello guys, In this series of new features of Java 10 articles, today, I am going to talk about probably the most popular and most useful, the introduction of var keyword (well, it's not really a keyword but I'll you later about it) in Java. If I am not wrong, this feature was supposed to come on Java 9 but dropped later. Finally, Java also has a var keyword to declare local variables which allows you to declare a variable without their type like instead of doing String str = "Java" you can now just say var str = "Java". This may not sound much gain when declaring String or an int variable but consider complex types with generics, this will surely save a lot of typing and also improves the readability of code.
How to Sort a List in Reverse Order in Java? ArrayList Example
Java Collection Framework provides a convenient reverse comparator, to
sort a List of objects in reverse order. You can obtain reverse Comparator, by
calling Collections.reverseOrder(), which by
default sort List of Integer in reverse
numeric order and List of String in reverse alphabetic order. It
actually reverses the natural ordering of objects imposed by the Comparable interface. Apart from this method, Collections class also
provides an overloaded method Collections.reverseOrder(Comparator
cmp) , which takes a Comparator,
and sorts List on reverse order of that Comparator.
Labels:
core java
,
java collection tutorial
,
programming
What is the real use of Method overloading in Java and Object Oriented Programming? Example
Many programmers, including Java and C++ developer, knows about the object oriented programming concepts like method overloading or function overloading, but if you ask them why you should overload a method? Many of them become clueless. This is a common problem of half learning i.e. you know the concept but you don't know the application. If you neither know what problem it solves nor what benefit it provides, then just knowing the concept is not enough. You won't be able to reap all benefits if you just know the concept and never use that in practice. If you are wondering what is the real use of method overloading then don't worry, I will share the answer in this article. Btw, this is also one of the popular object oriented programming interview question and its good to know about it.
Labels:
core java
,
object oriented programming
Friday, February 10, 2023
How to get Id of an HTML and DOM object in jQuery? Example Tutorial
As a page author, the id of an HTML element is something you should know. Still, there are scenarios when the page is automatically generated, or maybe some form elements are generated by using frameworks like JSF. In that case, what do you do if you want to find an id attribute of some elements in the page programmatically? How do you find those ids using jQuery? There are several ways to solve this problem, a couple of them in this article itself. The jQuery API provides many methods to get any attribute or property, including the id of an HTML element programmatically.
Labels:
JavaScript
,
JQuery
Saturday, February 4, 2023
How to use State Design Pattern in Java? Vending Machine Example
The State design pattern is a behavioral pattern, first introduced by GOF in their class is book design patterns. State pattern looks similar to Strategy pattern but it helps in managing object state and thus enabling them to behave differently in a different state. In this example, we will take a famous object-oriented design interview question, implementing Vending Machine in Java. In the past, we have solved this problem without using any design pattern, but here we will use state design patterns to create a vending machine with different states. This example will not just help you to understand how to implement State Design Pattern in Java but also gives you experience about when to use State Pattern on your application.
Labels:
core java
,
design patterns
,
interview questions
Wednesday, February 1, 2023
Difference between Statement vs PreparedStatement vs CallableStatement in Java JDBC
Hello Java programmers, if you are looking to find out the difference between Statement, PreparedStatement, and CallableStatement in Java then you have come to the right place. Earlier, I have shared common JDBC Interview Questions and in this article, I am going to explain what is the real difference between these Statement types in Java and when to use Statement, PreparedStatement, and CallableStatement in Java programs. JDBC API provides several classes and interfaces for various things, but three of the most important types of Statement classes are Statement, PreparedStatment, and CallableStatement. They are designed to execute different types of SQL queries.
Labels:
core java interview question
,
JDBC
Tuesday, January 31, 2023
How to Create Auto Incremented Identity Column in SQL Server, MySQL, and Oracle? Example
Automatic incremented ID, Sequence, or Identity columns are those columns
in any table whose value is automatically incremented by database based upon
predefined rule. Almost all databases e.g. Microsoft
SQL Server, MySQL,
Oracle
or Sybase supports auto-incremented identity columns but in different ways like
Oracle provides a SEQUENCE object which can be used to
generate automatic numbers, Microsoft SQL Server up to 2008 version provides IDENTITY() functions
for a similar purpose. Sybase also has IDENTITY function
but little different than SQL Server and MySQL uses auto_incremented keyword to
make any numeric column auto-incremented.
Labels:
database
,
database interview questions
,
mysql
,
SQL
,
SQL Interview Questions
,
Sybase and SQL Server
Top 10 Oracle Interview Question and Answer - Database and SQL
These are some interview questions and answers asked during my recent interview. Oracle interview questions are very important during any programming job interview. The interviewer always wants to check how comfortable we are with any database either we go for the Java developer position or C, C++ programmer position. So here I have discussed some basic questions related to the oracle database. Apart from these questions which are very specific to the Oracle database, you may find some general questions related to database fundamentals and SQL like Difference between correlated and noncorrelated subquery in database or truncate vs delete in SQL, etc.
Labels:
Oracle
,
SQL
,
SQL Interview Questions
Thursday, January 26, 2023
Difference between SubStr vs SubString function in JavaScript - Tutorial Example
Hello guys, if you are wondering what is difference between SubStr() and SubString() function in JavaScript then you have come to the right place. JavaScript provides two similar-looking String manipulation functions, substr and substring, though
both are used to get a substring from a String, there is a subtle difference
between substring and substr method in JavaScript. If you look at their signature, both substr(to,
length) and substring(to, from) both take two parameters, but substr takes the length of the substring to be returned, while substring takes end index (excluding)
for substring. This main difference will be more clear when we will see a couple of examples of using substr and substring in JavaScript code.
Labels:
HTML and JavaScript
,
Java web tutorial
,
programming
Tuesday, January 24, 2023
10 Reasons to Learn React Native for App Development in 2024
Hello guys, if you want to get into App development in 2024 then you have a couple of choices. For example, you can learn Flutter and React Native to develop cross platform apps, or you can learn Android or iOS to develop native apps. Android has been my favorite because you can use Java programming language to code Android application and being a Java developer, that was the easiest way to get into App development but if you are coming form JavaScript background then learning Java or Swift (which is required for iOS app development) could be difficult. You can either learn Dart to use Flutter or you can stick with JavaScript and learn React Native, which I think the best way for a JavaScript developer to get into App development in 2024 but if you are still not convinced, In this article, I am going to share 10 reasons to learn React Native, which can help you make a decision on which technology you should learn for app development in 2024.
Labels:
app development
,
best of javarevisited
,
JavaScript
,
React Native
Monday, January 23, 2023
What is a Functional interface in Java 8? @FunctionalInterface Annotation Examples Tutorial
Hello Java programmers, if you are wondering what is a functional interface and what is the role of @Functional annotation in Java then you have come to the right place. Earlier, I have shared the best Lambda and Stream courses and books, and in this article, I will explain and teach you how to create a functional interface in Java. A functional interface is nothing but an interface with just one abstract method like Runnable, Callable, Supplier, Predicate, etc. You can use @Functional annotation to mark that this is a functional interface. If a function expects a functional interface then you can also pass a lambda expression to it and that's the main benefit of a Functional interface in Java. This is also a popular Lambda Expression Interview question so, knowing this topic in depth is also better for interviews.
Labels:
functional interface
,
Java 8
,
Lambda expression
Friday, January 20, 2023
Strategy Design Pattern in Java using Enum - Tutorial Example
Hello guys, how are you doing? I hope you all are fine and doing good in your life and career. Today, I am going to talk about the Strategy pattern, one of the useful design and coding pattern which will help you to write flexible code. The code which can withstand the test of time in Production. I'll also teach you how you can use Enum to implement the Strategy design pattern and Open Closed design principle better in Java. I have said this before that Java Enum is very versatile and can do a lot more than you normally expect from it. We have seen a lot of examples of Enum in my earlier posts like writing thread-safe Singleton using Enum and 10 ways to use Enum in Java.
Labels:
core java
,
design patterns
,
Enum
,
programming
Wednesday, December 7, 2022
Is Java Pass by Value or Pass by Reference? Example
Hello guys, Does Java is pass by value or pass by reference is one of the tricky Java questions mostly asked on both beginner and experienced level Java developer interviews. Before debating
whether Java is pass by value or pass by reference lets first clear what is
pass by value and what is pass by reference actually means?. This question has its origin in C
and C++ where you can pass function parameter either value or memory address,
where value is stored (pointer). As per Java specification everything in Java
is pass by value whether its primitive value or objects and it does make sense
because Java doesn't support pointers or pointer arithmetic, Similarly multiple inheritance and operator
overloading is also not supported in Java.
Labels:
core java
,
core java interview question
Wednesday, September 21, 2022
Difference between CAST, CONVERT, and PARSE SQL Server? Example Tutorial
Though all three, CAST, CONVERT, and PARSE are used to convert one data type into another in SQL Server, there are some subtle differences between them. The CAST method accepts just two parameters, expression, and target type, but CONVERT() also takes a third parameter representing the format of conversion, which is supported for some conversions, like between character strings and date-time values. For example, CONVERT(DATE, '2/7/2015', 101) converts the character string '2/7/2015' to DATE using DATE format 101, representing United States standard.
Labels:
Microsoft SQL Server
,
SQL
,
SQL Interview Questions
Subscribe to:
Posts
(
Atom
)