Java

Product Discount Calculation Java Mysql

This tutorial will teach you how to make a Inventory Management System in Java and Mysql special discount calculation . This system will helpful you to learn Inventory Management System. Establish the Database Connection Connection con; PreparedStatement pst; public void Connect() { try { Class.forName(“com.mysql.jdbc.Driver”); con = DriverManager.getConnection(“jdbc:mysql://localhost/inventory”,”root”,””); } catch (ClassNotFoundException ex) { ex.printStackTrace(); }

Product Discount Calculation Java Mysql Read More »

Arrays in Java

  Array Index always start with 0 position. Example 1 public class Ex1{ public static void main(String[] args) { int numbers[]; numbers = new int[6]; numbers[0] = 30; numbers[1] = 25; numbers[2] = 20; numbers[3] = 15; numbers[4] = 5; for(int x=0; x<5; x++) { System.out.println(“Numbers ” +(x+1) + ” is ” + numbers[x]) ;

Arrays in Java Read More »

Switch Statement in Java

What is a Switch Statement? java switch statement in Java is used to execute one block of code among multiple alternatives based on the value of a variable. It is an alternative to using multiple if-else conditions. public class Switch1 { public static void main(String[] args) { int x=3; switch(x) { case 0: System.out.println(“0”); break;

Switch Statement in Java Read More »

Loops in java

Loop are use to print the block of code data again by again.In Java Consist of 3 Loops. 1.for loop 2.while loop 3.do while loop for loop Public class Loop1{ public static void main(String[] args) { for(int x=1; x<10; x++) { System.out.println(x); } } } Output 1 2 3 4 5 6 7 8 9

Loops in java Read More »