Difference between logical operators and or Java
Basic difference remember it!!!
if(TRUE && TRUE && TRUE) return TRUE otherwise FALSE
if(FALSE || FALSE || FALSE) return FALSE otherwise TRUE
Logical operator and &&
If all conditions/operands is TRUE return TRUE, otherwise return FALSE
Logical operator or ||
The logical OR operator (||) returns the boolean value true if either or both operands is true and returns false otherwise.
If one operands is TRUE, condition is TRUE:
rev
if(TRUE && TRUE && TRUE) return TRUE otherwise FALSE
if(FALSE || FALSE || FALSE) return FALSE otherwise TRUE
Logical operator and &&
If all conditions/operands is TRUE return TRUE, otherwise return FALSE
if( true and true and true){
// return true - do something
}
int a = 6;
if(a == 6 && a == 6 ) {
// if TRUE
// true && true return true, do something
}
if(a == 6 && a == 5){
// nothing, not attended
}else{
// true && false return false, or false && false return false
// do something
}
Logical operator or ||
The logical OR operator (||) returns the boolean value true if either or both operands is true and returns false otherwise.
If one operands is TRUE, condition is TRUE:
if(FALSE OR FALSE OR TRUE) return TRUE
if(FALSE OR TRUE OR FALSE) return TRUE
if(FALSE OR FALSE OR FALSE) return FALSE
int a = 6;
if(a==6 || a==5){ // TRUE || FALSE return TRUE
//if return TRUE
//one from operadns is TRUE return true, do something
}
if(a==5 || a==4){ // FALSE || FALSE return FALSE
// not attended
}else{
//if return FALSE, do something
}
rev
396LW NO topic_id
AD
Další témata ....(Topics)
Go to Eclipse menu:
Window -> Preferences -> Java -> Code Style -> Formatter
Press NEW profile or EDIT if have you some profile.
Setup your settings.
Save settings.
Window -> Preferences -> Java -> Code Style -> Formatter
Press NEW profile or EDIT if have you some profile.
Setup your settings.
Save settings.
PNG, GIF, BMP, JPG
// //www.apache.org/licenses/LICENSE-2.0
// 1.) Bitmap from stream
InputStream is = context.getResources().openRawResource(R.drawable.my_image);
mBitmap = BitmapFactory.decodeStream(is);
// 2.)
Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.ball);
int dstWidth =120;
int dstHeight = 120;
mBitmap = Bitmap.createScaledBitmap(ball, dstWidth, dstHeight, true);
// 3.)
Bitmap mBitmap = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
Bitmap mBitmap;
Canvas mCanvas;
Paint mBitmapPaint;
mBitmap = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
// 4.)
Bitmap mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
Canvas mCanvas.setBitmap(mBitmap);
mCanvas.drawColor(0xFFFFFFFF);
RelativeLayout like parent, child Srollview is centered horizontal.
Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically.
Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="//schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_horizontal">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView2" >
<RelativeLayout
android:layout_width="320dp"
android:layout_height="wrap_content"
android:background="#e6f825"
android:gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Difference between "@+id/” and "@id/” in Android
android:id="@+id/xxx" unique identifier of view
@id/ a reference to the unique identifier
android:id="@+id/xxx" unique identifier of view
@id/ a reference to the unique identifier
<TextView
android:id="@+id/first_element_id"
.........
/>
<TextView
android:id="@+id/second_element_id"
android:layout_below="@id/first_element_id"
..........
/>
Nejmenší telefon od Samsungu s Androidem se někdy přidává i jako dárek k zakoupenému zboží, přesto tento telefon toho za svou cenu něco přes 2 000 korun umí hodně.
Technické parametry Samsung Galaxy Pocket
Rozměry a hmotnost: 103,70 × 57,50 × 12 mm, 97 g
Sítě GSM 850 / 900 / 1800 / 1900 MHz, W-CDMA (3G) 900 MHz / 2 100 MHz
Displej TFT TN, 2,80" (320 × 240 px), dotykový: kapacitní
Procesor 832 MHz
Paměť RAM 256 MB, vnitřní paměť 3 GB, paměťové karty microSD
Operační systém Android 2.3, údajně nelze upgradovat
Hudba: mp3, aac, wav, wma
Video: mp4, 3gp, 320 × 240 px, 15 FPS
Fotoaparát 2 Mpx
Navigace vestavěná GPS, elektronický kompas
Baterie 1 200 mAh, pohotovostní doba: 312 hodin
Cena něco přes 2 000 korun / léto 2012
Technické parametry Samsung Galaxy Pocket
Rozměry a hmotnost: 103,70 × 57,50 × 12 mm, 97 g
Sítě GSM 850 / 900 / 1800 / 1900 MHz, W-CDMA (3G) 900 MHz / 2 100 MHz
Displej TFT TN, 2,80" (320 × 240 px), dotykový: kapacitní
Procesor 832 MHz
Paměť RAM 256 MB, vnitřní paměť 3 GB, paměťové karty microSD
Operační systém Android 2.3, údajně nelze upgradovat
Hudba: mp3, aac, wav, wma
Video: mp4, 3gp, 320 × 240 px, 15 FPS
Fotoaparát 2 Mpx
Navigace vestavěná GPS, elektronický kompas
Baterie 1 200 mAh, pohotovostní doba: 312 hodin
Cena něco přes 2 000 korun / léto 2012
Editace: 2016-02-29 17:06:05
Počet článků v kategorii: 396
Url:difference-between-logical-operators-and-or-java