Skip to main content

Posts

#NumberPattern #patterns How to print Pattern of number.

        Pattern Printing Program of Number ============================================== class Pattern{       public static void main(String args[]){                 for(int i=5;i>=1;i--){                               for(int j=i;j<=5;j++){                    System.out.print(j+" ");                                    }         System.out.println();        }    } } This Is above are the java code program to print the Pattern Like that.  Output: 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 This is output of this program we can change also with your own requirement in java.     

Sasken Technology objective Question || Java Written test online

     Sasken Technology objective Question in         Naresh IT  =============================================== 1.  class Test   { public static void main(String[] args)  { int a=30; System.out.println((float)a); } } Ans: 30.0 2.  class Test   { public static void main(String[] args)  { int a=30; System.out.println((Float)a); } } Ans:Compile time error becouse. Compiler   unable to convert int to Float Object 3. What is the  return type of the hashCode();  Ans: Acutally hash code Returun type is int       Prototype of hashCode() method is    int hashCode();   It is declear in the Object class  4. What is return type of the toString() method Ans:  Return type of the toString() method is       String object 5. What is Correct Prototype of finalize() method   Ans: finalize method is avilable in the class Object       It is protected void finalize(); method is avilable 6. What is the output of this Question in java   class

There are N number of bootball players standing in a circle. BTW they all have a gun in there hands. Each player has there skill (a non-negative integer) and he can only kill those players that have strictly less skill than him. one more thing,all the guns have only one bullet. this roulette can take place in any randome order fortunitly, you have the time stone(Yes the green)one and we can see all the possible outcomes of this scenario. find the outcmes where the total sum of the remaning playres skill is minimum. print the sum.

                                      *** All online Coding problam*** ======================================================================== Algorithm Test:  There are N number of bootball players standing in a circle. BTW they all have a gun   in there hands. Each player has there skill (a non-negative integer) and he can only   kill those players that have strictly less skill than him. one more thing,all the guns   have only one bullet. this roulette can take place in any randome order fortunitly,  you have the time stone(Yes the green)one and we can see all the possible outcomes  of this scenario. find the outcmes where the total sum of the remaning playres skill is  minimum. print the sum.  Input:    6    2 8 3 3 5 5      Output:    13 Explanation:    1. First line of sample input is no of playres    2. Second line of sample input is skill of the playres. step 1:3 will kill less skill 2 step 2:Both having skill 5 will kill both 3 step 3:8 will kill  5

HOW TO REMOVE DUPLICATE ELEMENTS IN ARRAY. || B...

Remove Duplicate Element in Array ====================================== Array ={10,20,10,30,50,40,30}; 1. Take one Arrays and sort this Array. Array={10,10,20,30,30,40,50}; 2. Removed this duplicate element in array. Coding : package InterviewQuestio; import java.util.Arrays; public class RemoveDuplicateElementInArray { public static void main(String[] args) { int arr[]= {10,20,10,30,50,40,30}; System.out.println(Arrays.toString(arr)); Arrays.parallelSort(arr);//Sorted array int j=0; int temp[]=new int[arr.length]; for(int i=0;i =0) { System.out.print(arr[j--]+" "); } } }

Java Interviews Question || Freshers 10

                     Java Interviews Question ======================================= 1. Which language you know very well. Ans: Sir, I know java language very well. 2.What is Inheritance in java and also types of in inheritance. Ans: The process of creating a new class extend and implement the type,property,behavier of already existing object in our class that techniques is called a inheritance. Actually java support 3- types of in heritance in java. A. Single inheritance B. Multi-level inheritance C. Hierarical inheritance Java Does not support D.Hybrid inheritance E.Multiple inheritance 3. Why java not support multiple in Heritance. Ans: suppose you have a one class . this class extending the two other class . two other class having the same signature of method. so, java confused which class method i am going to execute that's why java does't support multip

How to Convert Decimal number to Hexadecimal number in java programming\\ by er prince kumar

DecimalToHexadecimal ======================================================== HexaDecimal Example : 20 20%16--remender==4 than you have to divide 16 you got 1 than 1%16--remender==1 Final HexaDecimal =14 01,1345,..... 0 ,1,2,3.....9,A,B,C,D,E,F =16 ========================================================================================= import java.util.Scanner; class DecToHex { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the Decimal Number:"); int n=sc.nextInt(); char chars[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; String hex=""; int mid=0; while(n!=0){//20 mid=n%16; hex=chars[mid]+hex; n=n/16; } System.o

#Perfect Number Write a program of Perfect Number series in java languag...

Perfect Number ============================================================================================ 6 why becouse = 6%1==0-->true 1 1+2+3=6 6%2==0-->true 2 6%3==0-->true 3 6%4==0-->false * 6%5==0-->false * n= 4 why 4%1==0 true 1-> 1+2=3 4%2==0 true 2 4%3==0 false * //series of perfect Number import java.util.Scanner; class Perfect1{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int sum=0; for(int i=1;i<=n;i++){ sum=0; for(int j=1;j