The Class DataInputStream is baselly handle a primitive type data types
write a programme to input your Firstname,lastname input them.
import java.io.*; public class DataInputstream { public static void main(String[] args) { DataInputStream dis = new DataInputStream(System.in); String fname,lname; fname = ""; lname = ""; try { System.out.print("Enter Your FirstName"); fname = dis.readLine(); System.out.print("Enter Your LastName"); lname = dis.readLine(); System.out.println("FirstName is "+ fname); System.out.println("LastName is "+ lname); } catch (IOException ex) { ex.printStackTrace(); } } }
write a programme to input your num1,num2 and calculate the total.
import java.io.*; public class DataInputstream { public static void main(String[] args) { DataInputStream dis = new DataInputStream(System.in); int num1,num2,tot; try { System.out.print("Enter Your Num1"); num1 = Integer.parseInt(dis.readLine()); System.out.print("Enter Your Num2"); num2 = Integer.parseInt(dis.readLine()); tot = num1 + num2; System.out.println("Total is "+ tot); } catch (IOException ex) { ex.printStackTrace(); } } }
Conditional statements in Python allow us to control the flow of execution based on conditions.…
A Java Bean is a reusable software component that follows a specific set of conventions.…
Java provides a rich set of built-in methods for handling String operations efficiently. Since strings…
Java remains one of the most in-demand programming languages worldwide, powering everything from enterprise applications…
Java provides multiple ways to convert an integer (int) to a string (String). Whether you're…
Java Server Pages (JSP) is a powerful technology used to develop dynamic web applications by…