Arjun Thakur

Arjun Thakur

749 Articles Published

Articles by Arjun Thakur

Page 37 of 75

Java Program to set the extent in JSlider

Arjun Thakur
Arjun Thakur
Updated on 02-Jan-2025 356 Views

In this article, we will learn how to set the extent of a JSlider using Java Swing. The extent defines the size of the range that the slider's knob can move within, restricting its movement past a certain point. JSlider JSlider is a component in Java Swing that provides a visual way to select a value by sliding a knob within a specified range. The setExtent() method in JSlider sets the size of the range that the knob covers, which controls how far it can move. setExtent() method The setExtent() method in Java is used to: ...

Read More

Java program to find largest of the three numbers using ternary operators

Arjun Thakur
Arjun Thakur
Updated on 11-Dec-2024 2K+ Views

In this article, we’ll learn to find the largest of three numbers using the ternary operator in Java. This simple yet effective approach allows you to write concise and readable code. Finding the largest of three numbers is a common programming task, and Java provides an efficient way to do this using the ternary operator. This concise approach reduces code complexity while maintaining readability. What is the Ternary Operator in Java?  The ternary operator is a shorthand for if-else statements in Java. It uses the syntax: condition ? value_if_true : value_if_false This operator is useful for simple conditional checks and ...

Read More

Java program to swap two numbers using XOR operator

Arjun Thakur
Arjun Thakur
Updated on 05-Nov-2024 892 Views

In this article, we will learn how to swap two numbers using the XOR bitwise operator in Java. The XOR operator is a powerful tool that allows you to perform bitwise operations, and one of its interesting properties is that it can be used to swap two variables without using a temporary variable. This method is efficient and can be used when you need a fast swapping mechanism. Problem StatementGiven two integers, write a Java program to swap their values using the XOR operator.Input Two integers are provided by the user.Output The values of the two integers after swapping. ...

Read More

Java program to fill elements in a char array

Arjun Thakur
Arjun Thakur
Updated on 18-Oct-2024 1K+ Views

In this article, we will fill elements in a char array using Java. We will be using the Arrays.fill() method to fill it with a specific character. This method allows us to assign a single character value to all elements in the array. We will fill the array with the character 'A' and then print the array using Arrays.toString() to display its contents in a readable format. Problem Statement Write a Java program to fill elements in a char array − Input charValue = 'A' Output The char array content is: [A, A, A, A, A] Steps to fill elements in a ...

Read More

Java program without making class

Arjun Thakur
Arjun Thakur
Updated on 16-Oct-2024 1K+ Views

Is it possible to create and run a Java program without any class? The answer is Yes. The trick is to use an enum instead of a Class.Enums are similar to classes, but instead of using the class keyword, we use enum to define them. An enum is used to represent a public static constant. It can have a static main method as well.  Steps to write Java program without making classFollowing are the steps to write a Java program without making class −We will start by defining an enum instead of a class. An enum typically represents constants, but it can also ...

Read More

Java program to join two given lists

Arjun Thakur
Arjun Thakur
Updated on 14-Aug-2024 3K+ Views

To join two given lists the addAll() method of the java.util.ArrayList class is used to insert all of the elements in the specified collection into this list. To add contents of a list to another − Problem Statement Write a program in Java to join two given lists − Input Contents of list1 ::[Apple, Orange, Banana] Contents of list2 ::[Grapes, Mango, Strawberry] Output Contents of list1 after adding list2 to it ::[Apple, Orange, Banana, Grapes, Mango, Strawberry] Steps to join two given lists Following are the steps to join two given lists − ...

Read More

How to Convert Decimal to Hexadecimal?

Arjun Thakur
Arjun Thakur
Updated on 31-Oct-2023 65K+ Views

Decimal system is most familiar number system to the general public. It is base 10 which has only 10 symbols − 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Whereas Hexadecimal system is most familiar number system color representation in Computers or digital systems. It is base 16 which has only 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F. These A, B, C, D, E, F use as single digit in place of double digits, 10, 11, 12, 13, 14, 15 respectively.Conversion from Decimal to Hexadecimal ...

Read More

Fixed Point and Floating Point Number Representations

Arjun Thakur
Arjun Thakur
Updated on 31-Oct-2023 135K+ Views

Digital Computers use Binary number system to represent all types of information inside the computers. Alphanumeric characters are represented using binary bits (i.e., 0 and 1). Digital representations are easier to design, storage is easy, accuracy and precision are greater.There are various types of number representation techniques for digital number representation, for example: Binary number system, octal number system, decimal number system, and hexadecimal number system etc. But Binary number system is most relevant and popular for representing numbers in digital computer system.Storing Real NumberThese are structures as following below −There are two major approaches to store real numbers (i.e., ...

Read More

8085 Program to Add two 8 Bit numbers

Arjun Thakur
Arjun Thakur
Updated on 07-Oct-2023 40K+ Views

In this program, we will see how to add two 8-bit numbers using 8085 microprocessor.Problem StatementWrite 8085 Assembly language program to add two 8-bit numbers and store the result at locations 8050H and 8051H.DiscussionTo perform this task, we are using the ADD operation of 8085 Microprocessor. When the result of the addition is the 1-byte result, then the carry flag will not be enabled. When the result is exceeding the 1-byte range, then the carry flag will be 1We are using two numbers at location 8000H and 8001H. When the numbers are 6CH and 24H, then the result will be ...

Read More

How to count the number of tables in a MySQL database?

Arjun Thakur
Arjun Thakur
Updated on 14-Sep-2023 40K+ Views

To count the total number of tables, use the concept of count(*) with table_schema. First, to check how many tables are present in our database "business", we need to use the 'show' command. mysql> show tables; The following is the output that displays all the tables in the database "business". +--------------------------+ | Tables_in_business | +--------------------------+ | addcheckconstraintdemo | | addcolumntable | | addconstraintdemo | | addnotnulldemo ...

Read More
Showing 361–370 of 749 articles
« Prev 1 35 36 37 38 39 75 Next »
Advertisements