Posts

Login Page in Java | IntelliJ Idea | Create Login Page

Image
Login Page in Java | IntelliJ Idea | Create Login Page  Program: package LoginPage ; //Code With Akash Learn With Akash import javax.swing. * ; import java.awt. * ; public class LoginPage { private JPanel panel1 ; private JTextField textField1 ; private JPasswordField passwordField1 ; private JButton loginButton ; private JFrame frame ; public LoginPage (){ frame = new JFrame ( "User Login Frame" ); frame . setDefaultCloseOperation ( WindowConstants . EXIT_ON_CLOSE ); frame . setPreferredSize ( new Dimension ( 300 , 250 )); frame . setResizable ( false ); //Now add the panel frame . add ( panel1 ); frame . pack (); frame . setLocationRelativeTo ( null ); frame . setVisible ( true ); } Source Code Tags -  Engineering Jobs  /  Fresher Jobs  /  Bsc Jobs For More Updates Join Telegram

Solve Any Pattern Question Using This Trick!

Image
Program: public class Patterns { public static void main ( String [] args ) { pattern7 ( 4 ); } /*pattern1 * * * * * * * * * * * 4 rows and 4 column */ static void pattern1 ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { // i is row for ( int j = 1 ; j <= i ; j ++ ) { // j is row System . out . print ( "* " ); } System . out . println (); } } /*pattern2 * * * * * * * * * * * * * * * * 4 rows and 4 column*/ static void pattern2 ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { // i is row for ( int j = 1 ; j <= n ; j ++ ) { // j is row System . out . print ( "* " ); } System . out . println (); } } /*pattern3 * * * * * * * * * * 4 rows and 4 column*/ static void pattern3 ( int n ) { for ( int i

Java Arrays Programs

 1. Write a program to store 10 students' marks. Program: public class Array { public static void main (String[] args) { //There are three ways to do // First way declare and initialize //int[] marks ={40,80,48,42,39,72,55,90,99,98}; // Second way //int[] marks; // Declaration //marks = new int[10];//Memory allocation //first way-> Declaration and memory allocation int [] marks = new int [ 10 ] ; // Takes value from 0 to 9 marks[ 0 ]= 40 ; marks[ 1 ]= 80 ; marks[ 2 ]= 48 ; marks[ 3 ]= 42 ; marks[ 4 ]= 39 ; marks[ 5 ]= 72 ; marks[ 6 ]= 55 ; marks[ 7 ]= 90 ; marks[ 8 ]= 99 ; marks[ 9 ]= 98 ; System. out .println(marks[ 5 ]) ; System. out .println( "Printing using for loop: " ) ; //for displaying all marks for ( int i= 0 ; i<marks. length ; i++){ System. out .println(marks[i]) ;

Java Loops Programs

 1. Write a Program to print the following Pattern-- **** *** ** * Program:  // Akash Suryawanshi // 25-Nov-2022 public class loops {     public static void main(String[] args) {         int n = 4;         for(int i=n;i>0;i--){             for(int j=0;j<i;j++){                 System.out.print("*");             }             System.out.print("\n");         }     }        } Output:  **** *** ** *  2. Write a program to sum first n even numbers using a while loop. Program: // Akash Suryawanshi // 25-Nov-2022 public class loops {     public static void main(String[] args) {         int sum = 0;         int n = 5;         for (int i = 0; i < n; i++) {             sum = sum+(2*i);         }         System.out.println("Sum of even number: " +sum);     } } Output: Sum of even number: 20   3. Write a program to print the multiplication table of a given number n. Program: // Akash Suryawanshi // 25-Nov-2022 public class loops {     public static void main(