Convert Binary Number to ASCII Code in 8085

Jennifer Nicholas
Updated on 29-Jun-2020 13:34:04

3K+ Views

Now let us see a program of Intel 8085 Microprocessor. This program will convert binary or hexadecimal number to ASCII values.Problem StatementWrite 8085 Assembly language program to convert binary or Hexadecimal characters to ASCII values. DiscussionWe know that the ASCII of number 00H is 30H (48D), and ASCII of 09H is39H (57D). So all other numbers are in the range 30H to 39H. TheASCII value of 0AH is 41H (65D) and ASCII of 0FH is 46H (70D), so all other alphabets (B, C, D, E, F) are in the range 41H to 46H.Here we are providing hexadecimal digit at memory location ... Read More

Alternative Solutions for Static Constructor in Java

Maruthi Krishna
Updated on 29-Jun-2020 13:33:19

539 Views

The main purpose of constructors in Java is to initialize the instance variables of a class.But, if a class have Static variables you cannot initialize them using the constructors (you can assign values to static variables in constructors but in that scenario, we are just assigning values to static variables). because static variables are loaded into the memory before instantiation (i.e. before constructors are invoked)So, we should initialize static variables from static context. We cannot use static before constructors, Therefore, as an alternation to you can use static blocks to initialize static variables.Static blockA static block is a block of ... Read More

What are Unreachable Blocks in Java

Maruthi Krishna
Updated on 29-Jun-2020 13:32:06

519 Views

A code block/statement in Java to which the control never reaches and never gets executed during the lifetime of the program is known as unreachable block/statement.Generally, it happens whenever a piece of code hasA return statement before it.An infinite loop before it.Java does not support unreachable code. If you have any such statements, (which are unreachable) Java compiler raises a compile time error.Example1In the following Java program, the class UnreachableCodeExample has a method named greet which returns a String value. After the return statement it has a print statement. Live Demopublic class UnreachableCodeExample {    public String greet() {     ... Read More

Understanding Dead Code Warning in Java Eclipse

Maruthi Krishna
Updated on 29-Jun-2020 13:30:28

1K+ Views

A code block/statement in Java to which the control never reaches and never gets executed during the lifetime of the program is known as unreachable block/statement.public class UnreachableCodeExample {    public String greet() {       System.out.println("This is a greet method ");       return "Hello";       System.out.println("This is an unreachable code ");    }    public static void main(String args[]) {       new UnreachableCodeExample().greet();    } }Dead codeA dead code is an unreachable code, but it doesn’t generate compile time error. But if you execute it in eclipse it gives you a warning.ExampleIn ... Read More

Different Ways to Print Exception Message in Java

Maruthi Krishna
Updated on 29-Jun-2020 13:27:07

9K+ Views

An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed.Printing the Exception messageYou can print the exception message in Java using one of the following methods which are inherited from Throwable class.printStackTrace() − This method prints the backtrace to the standard error stream.getMessage() − This method returns the detail message string of the current throwable object.toString() − This message prints the short description of the current throwable object.Example Live Demoimport java.util.Scanner;    public class ... Read More

Traverse TreeSet Elements in Descending Order in Java

George John
Updated on 29-Jun-2020 13:26:15

415 Views

Create TreeSet and add elements to itTreeSet tSet = new TreeSet(); tSet.add("P"); tSet.add("Q"); tSet.add("R"); tSet.add("S");Now, let us traverse elements in descending orderIterator j = tSet.descendingIterator(); while(j.hasNext()) {    System.out.println(j.next()); }The following is an example to traverse TreeSet elements in descending orderExample Live Demoimport java.util.*; public class Demo {    public static void main(String args[]){       TreeSet tSet = new TreeSet();       tSet.add("P");       tSet.add("Q");       tSet.add("R");       tSet.add("S");       System.out.println("TreeSet elements...");       Iterator i = tSet.iterator();       while(i.hasNext()){          System.out.println(i.next());     ... Read More

Insert Data into Table with Auto-Incremented Columns using JDBC

Smita Kapse
Updated on 29-Jun-2020 13:25:20

2K+ Views

While inserting data into a table with auto-incremented column, just leave that particular column out and insert remaining values by specifying the remaining columns using the following syntax of the INSERT statement −INSERT into table_name (column_name1, column_name2....) values(value1, value2....)ExampleLet us create a table with name sales in MySQL database, with one of the columns as auto-incremented, using CREATE statement as shown below −CREATE TABLE Sales(    ID INT PRIMARY KEY AUTO_INCREMENT,    ProductName VARCHAR (20),    CustomerName VARCHAR (20),    DispatchDate date,    DeliveryTime time,    Price INT,    Location VARCHAR(20) );Following JDBC program establishes a connection with the database ... Read More

Get Head Set from Java TreeSet

Chandu yadav
Updated on 29-Jun-2020 13:25:00

290 Views

To get Head Set, you need to use the headset() method. This allow a user to get a set of elements in sorted order.Firstly, set the TreeSet and add elementsTreeSet tSet = new TreeSet(); tSet.add("P"); tSet.add("Q"); tSet.add("R"); tSet.add("S");Let us now get the Head SetSortedSet s = tSet.headSet("S");The following is an example to get Head Set from TreeSet in JavaExample Live Demoimport java.util.*; public class Demo {    public static void main(String args[]){       TreeSet tSet = new TreeSet();       tSet.add("P");       tSet.add("Q");       tSet.add("R");       tSet.add("S");       System.out.println("TreeSet elements..."); ... Read More

Get First Value in Java TreeSet

George John
Updated on 29-Jun-2020 13:23:53

1K+ Views

To get the first value in TreeSet, use the first() method.First, get the TreeSet and add elements to itTreeSet tSet = new TreeSet(); tSet.add("10"); tSet.add("20"); tSet.add("30"); tSet.add("40"); tSet.add("50"); tSet.add("60");Now, get the first valuetSet.first()The following is an example to get the first value in TreeSetExample Live Demoimport java.util.*; public class Demo {    public static void main(String args[]){       TreeSet tSet = new TreeSet();       tSet.add("10");       tSet.add("20");       tSet.add("30");       tSet.add("40");       tSet.add("50");       tSet.add("60");       System.out.println("TreeSet elements...");       Iterator i = tSet.iterator(); ... Read More

Remove All Elements in Java IdentityHashMap

Ankith Reddy
Updated on 29-Jun-2020 13:22:48

142 Views

Use the clear() method to remove all the elements from IdentityHashMap in Java.Create a IdentityHashMap and add some elementsMap m = newIdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450);Now, let us remove all the elementm.clear();The following is an example to remove all elements in IdentityHashMap in JavaExample Live Demoimport java.util.*; public class Demo {    public static void main(String[] args) {       Map m = newIdentityHashMap();       m.put("1", 100);       m.put("2", 200);       m.put("3", 300);       m.put("4", 150); ... Read More

Advertisements