Answer:
Each pixel of light coming from your computer is made up of a combination of Red, Blue and Green light of different intensities. As this pixel of light is so small your eye only "sees" the combination of those 3 pixels as the intended colour. (as opposed to just red, green and blue light) (This is also known as additive colour mixing)
Answer:
- public static String bothStart(String text1, String text2){
- String s = "";
-
- if(text1.length() > text2.length()) {
- for (int i = 0; i < text2.length(); i++) {
- if (text1.charAt(i) == text2.charAt(i)) {
- s += text1.charAt(i);
- }else{
- break;
- }
- }
- return s;
- }else{
- for (int i = 0; i < text1.length(); i++) {
- if (text1.charAt(i) == text2.charAt(i)) {
- s += text1.charAt(i);
- }else{
- break;
- }
- }
- return s;
- }
- }
Explanation:
Let's start with creating a static method <em>bothStart()</em> with two String type parameters, <em>text1 </em>&<em> text2</em> (Line 1).
<em />
Create a String type variable, <em>s,</em> which will hold the value of the longest substring that both inputs start with the same character (Line 2).
There are two possible situation here: either <em>text1 </em>longer than<em> text2 </em>or vice versa. Hence, we need to create if-else statements to handle these two position conditions (Line 4 & Line 13).
If the length of<em> text1</em> is longer than <em>text2</em>, the for-loop should only traverse both of strings up to the length of the <em>text2 </em>(Line 5). Within the for-loop, we can use<em> charAt()</em> method to extract individual character from the<em> text1</em> & <em>text2 </em>and compare with each other (Line 15). If they are matched, the character should be joined with the string s (Line 16). If not, break the loop.
The program logic from (Line 14 - 20) is similar to the code segment above (Line 4 -12) except for-loop traverse up to the length of <em>text1 .</em>
<em />
At the end, return the s as output (Line 21).
D. Both A and C. In my opinion though...
Answer:
The correct option for the given question is option(A) i.e Increments the value currently stored in the variable x and stores that new value back in the variable x.
Explanation:
x++ is an increment operator Their are two types of increment operator
1.Post increment
2.Pre increment.
Post increment operator assign the value first to variable then increment the value by 1.
for example
int a=7,t;
t=a++; //post increment
Pre increment operator first increment the value by 1 then store into variable.
int a=7,t;
t=++a; // Pre increment.
So the correct answer is option(a)
Answer:
In order to insert text into a presentation, you add a text box from the insert menu. However, this could differ based on the software you are using. Hope this helps!