Samual Sam has Published 2492 Articles

Date format validation using Java Regex

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:45:34

577 Views

Following example demonstrates how to check whether the date is in a proper format or not using matches method of String class.ExampleLive Demopublic class Main {    public static void main(String[] argv) {       boolean isDate = false;       String date1 = "8-05-1988";       ... Read More

GregorianCalendar Class in Java

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:40:18

141 Views

GregorianCalendar is a concrete implementation of a Calendar class that implements the normal Gregorian calendar with which you are familiar. We did not discuss Calendar class in this tutorial, you can look up standard Java documentation for this.The getInstance( ) method of Calendar returns a GregorianCalendar initialized with the current date and ... Read More

Deadlock in Java Multithreading

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:30:28

2K+ Views

Deadlock describes a situation where two or more threads are blocked forever, waiting for each other. Deadlock occurs when multiple threads need the same locks but obtain them in a different order. A Java multithreaded program may suffer from the deadlock condition because the synchronized keyword causes the executing thread to block ... Read More

Date Formatting Using printf

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:26:09

5K+ Views

Date and time formatting can be done very easily using the printf method. You use a two-letter format, starting with t and ending in one of the letters of the table as shown in the following code.ExampleLive Demoimport java.util.Date; public class DateDemo {    public static void main(String args[]) ... Read More

C# Program to find whether the Number is Divisible by 2

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:14:32

6K+ Views

If the remainder of the number when it is divided by 2 is 0, then it would be divisible by 2.Let’s say our number is 5, we will check it using the following if-else −// checking if the number is divisible by 2 or not if (num % 2 == ... Read More

Common Language Runtime (CLR) in C#.NET

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:12:53

5K+ Views

Common Language Runtime (CLR) manages the execution of .NET programs. The just-in-time compiler converts the compiled code into machine instructions. This is what the computer executes.The services provided by CLR include memory management, exception handling, type safety, etc.Let us see the features of Common Language Runtime (CLR) in C#:ComponentsComponents in ... Read More

Create translucent windows in Java Swing

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:10:44

253 Views

With JDK 7, we can create a translucent window using swing very easily. With following code, a JFrame can be made translucent.// Set the window to 55% opaque (45% translucent). frame.setOpacity(0.55f);ExampleSee the example below of a window with 55% translucency.import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class ... Read More

Sleeping for a while in Java

Samual Sam

Samual Sam

Updated on 19-Jun-2020 12:04:25

675 Views

You can sleep for any period of time from one millisecond up to the lifetime of your computer. For example, the following program would sleep for 3 seconds −Example Live Demoimport java.util.*; public class SleepDemo {    public static void main(String args[]) {       try {     ... Read More

Create shaped windows in Java Swing

Samual Sam

Samual Sam

Updated on 19-Jun-2020 11:58:25

698 Views

With JDK 7, we can create a shaped window using swing very easily. Following are the steps needed to make a shaped window. Add a component listener to frame and override the componentResized() to change the shape of the frame. This method recalculates the shape of the frame correctly whenever the ... Read More

How can we remove multicolumn UNIQUE indexes?

Samual Sam

Samual Sam

Updated on 19-Jun-2020 11:50:48

65 Views

Multicolumn UNIQUE indexes can also be removed in the same as we remove UNIQUE constraint from the table.ExampleIn this example, with the following query we have removed the multicolumn UNIQUE indexes on table ‘employee’ −mysql> DROP index id_fname_lname on employee; Query OK, 0 rows affected (0.30 sec) Records: 0 Duplicates: ... Read More

Advertisements