Skip to main content

Posts

Showing posts from September, 2018

C++ Program to Find HCF and LCM among 4 numbers (Easiest Logic)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #include <iostream> #include <math.h> using namespace std; int main () { int a,b,c,d,i,j,minimum; cout << "Enter the all four number " ; cin >> a >> b >> c >> d; if (a < b && a < c && a < d) minimum = a; else if (b < c && b < d) minimum = b; else if (c < d) minimum = c; else minimum = d; for (j = minimum;; -- j) { if (a % j == 0 && b % j == 0 && c % j == 0 && d % j == 0 ) { break ; } } for (i = 1 ;;i ++ ) { if (i % a == 0 && i % b == 0 && i % c == 0 && i % d == 0 ) break ; } cout << "Lowest Common factor=>" << i << endl; ...

Reserved Words In JAVA (total 53 Reserve Words)

RESERVED WORDS: In java the words which are having fixed functionalities or fixed Values are called as reserve words. Total Number of reserve words =53. Category of Reserve Words: 1 .Keywords ---> The words which are having fixed Functionalities. 2. Literals (Constant)---->The words which are having fixed Values .(3)---- i) true ii) false iii) null. NOTE: all the reserved words (Keywords and Literals) are in small letters. Keywords: (i) Datatype related :- byte ,short,int ,long,float,double,char,boolean. (ii) Flow Control Related Keywords: - if ,else ,switch,case ,default,continue,break,for,while,do while. (iii) Method Related Keywords:- void ,return. (iv) Unused keywords: goto ,const. (v) New Keywords: assert,enum. (vi) exception handling Keywords: try,catch,finally,throws,throw. (vii) Class Related keywords : class,extends,interface,implements,pacakage,import. (viii) Object Related Keywords: this,new,super,instanceof. ...

Identifier IN JAVA

Idenifiers: Any Name in Java which is used for identifing Purpose is called as Identifier.. Ex:- className,VariableName,Method name,Constructor Name are Identifiers. Rules for Identifiers: 1. Identifiers Can have alphanumeric Values and $ and _. 2. Identifiers can not start from Numbers.. 3. Identifiers are Case sensitive. 4. There is no length Limit in Identifiers. 5. Pre-defined Keywords cant be used as an Identifiers. 6. Pre-defined Classname,Methodname,Interface Name,variable Name etc can be used as an Identifiers. Recommendation: 1. Pre-defined Classname,Methodname,Interface Name,variable Name etc should not be used as an Identifiers because it creates confusion. CASE STUDY: class Test { public static void main (String [] beast) { System.out.println("Test in progress"); int System=10; System.out.println(a); } } OUTPUT: Compilation Error: test.ja...