I am trying to create a String array from a single array. For example, if string is "arr", i want my array to store {"a","a","a"}. I know I can use .toCharArray() but i want to understand why this approach does not work. Thanks.      package Labs;  public class ses {     public static void main(String args[])     {         String ar = "aaaaa";         String av[] = new String[5];         for(int i=0;i&lt;5;i++)         {             av[i] = ar.substring(i,i+1);             System.out.println(av[i]);             if(av[i]=="a")             {                 System.out.println("true");             }             else             {                 System.out.println("false");              }      }  } }  OUTPUT a false a false a false a false a false
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Whenever I startup from the LinuxLive USB, and try to install Ubuntu 12.04, it only gives me two options instead of the usual 3 or 4. My options are "Replace Windows 7 with Ubuntu" and "Something Else". Whenever I go into "Something else", it looks extremely confusing. How do I install it side-by-side while using the "Something else" section? These are my partitions.   /dev/sda /dev/sda1 ntfs (104Mb, System Required Partition) /dev/sda2 ntfs (1000097Mb, Windows 7 Partition)   Or should I try reinstalling my installer on a CD rather than USB and maybe then it will have the "Install alongside" function? In Python, I can compile a regular expression to be case-insensitive using re.compile:  &gt;&gt;&gt; s = 'TeSt' &gt;&gt;&gt; casesensitive = re.compile('test') &gt;&gt;&gt; ignorecase = re.compile('test', re.IGNORECASE) &gt;&gt;&gt;  &gt;&gt;&gt; print casesensitive.match(s) None &gt;&gt;&gt; print ignorecase.match(s) &lt;_sre.SRE_Match object at 0x02F0B608&gt;   Is there a way to do the same, but without using re.compile. I can't find anything like Perl's i suffix (e.g. m/test/i) in the documentation. Gravitational waves and time Two questions.  It is said that time can only go slower in gravity fields and if you move faster.  I have heard that when a gravitational wave pass earth then the space/time vibrate and time change for an instance.  But a wave is often with a top and a valley.  They have now atomic clocks that might be able to detect time variations, placed in satellites around the sun and "quantum entangled". "Using Atomic Clocks to Detect Gravitational Waves"   So what if we could compare time ticks between clocks in space at "absolute frame of reference" where time has its maximum universal speed as time in deep space between Galaxy Filaments.  Will we only detect that time ticks slower for an instance when the gravational wave pass?  1. Or will we detect that time tick slower AND faster than normal time also, as compared to zero gravity time and no movement time in "absolute frame of reference"?  2. Can time go let's say 10 times faster by theory/mathematics, by a extreme theoretical gravitational wave, than time in "absolute frame of reference time"? Vectors, structs and std::find Are neutrinos affected by electromagnetic forces? I know they don't interact with matter nor any electromagnetic forces, but I know they have mass, very little mass but they have. When something has mass it must be attracted by gravity and other objects (electromagnetic) right? Most of you if not everybody will agree that the stronger the gravitational pull, the faster an object will fall. For example, on a planet with 50 times the gravity of Earth, any object will hit the ground on that planet much quicker than it would on Earth. So taking all of these into the equation, does it mean that at a blackhole, an object will fall at an infinite speed because of the infinitely strong gravitational pull of the blackhole? Xdotool using "DISPLAY=:0" not works in Crontab MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES) how to left justify comments to indent same as other text in Algorithmic How do I left justify my comments in the algorithm.  I am using algorithmicx package.  What I want is: to pull the comment to left as shown in the attached snapshot.  The code for my algorithm is       \documentclass[a4paper]{article}     \pagestyle{empty}     \usepackage{algorithm}     \usepackage{algpseudocode}     \usepackage[caption=false,font=footnotesize]{subfig}     \begin{document}     \begin{algorithm} \label{algoQ}     \caption{Algorithm to check quality of methods}     \begin{algorithmic}     \For{\textbf{each} $msd$ in$msdList$}  \Comment { \% for each MSD \%}     \Statex   \Comment { \% get MSDs referenced method service \%}     \EndFor \textbf{endFor}     \end{algorithmic}     \end{algorithm}     \end{document} Why do I get blurry pictures when I take a lens attachment off? File list command line (hidden and subfolders) Transfer / security in Istanbul Ataturk airport after 29/06/2016 I am going to Nepal and probably, same as everyone, through Delhi. I was considering going overland from Delhi to Kathmandu, however I have found many posts that advise against it in favor of a flight. The following concerns are the key to the proper decision, I think.  Does the overland route offer a good scenery and cultural experience or is it  better to spend that time in Nepal?  What is the rough cost of an overland journey and how does it compare with a flight?  In case of a flight, is the Indian visa necessary? I am writing an application that if the user hits back, it may resend the same information and mess up the flow and integrity of data. How do I disable it for users who are with and without javascript on? Is there a "theirs" version of "git merge -s ours"? When merging topic branch "B" into "A" using git merge, I get some conflicts. I know all the conflicts can be solved using the version in "B".  I am aware of git merge -s ours. But what I want is something like git merge -s theirs.   Why doesn't it exist? How can I achieve the same result after the conflicting merge with existing git commands? (git checkout every unmerged file from B)  UPDATE: The "solution" of just discarding anything from branch A (the merge commit point to B version of the tree) is not what I am looking for. Why 220V and 110V? Why did the industry choose these seemingly unintuitive values of 110V and 220V for the mains AC? Is there a physical reason why they aren't simply 100V and 200V? Dictionaries on iOS 8 not working How to change inside background color of UISearchBar component on iOS Ubuntu Software doesn't open in Ubuntu 20.04 If i click on Ubuntu Software, it doesn't open. I have a fresh install of Ubuntu 20.04. I tried try to upgrade all packages, but it doesn't fix this problem.  If I try to run killall software-center there is no process with this name, and software-center returns command not found. If I try to reinstall it with apt I have these results:  $ sudo apt-get --purge --reinstall install software-center Reading package lists... Done Building dependency tree        Reading state information... Done Package oracle-java8-installer is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'software-center' has no installation candidate Operation not permitted turning off airplay mirroring