Skip to content
Advertisement

Parenthesis/Brackets Matching using Stack algorithm

For example if the parenthesis/brackets is matching in the following: and so on but if the parenthesis/brackets is not matching it should return false, eg: and so on. Can you please check this code? Thanks in advance. Answer Your code has some confusion in its handling of the ‘{‘ and ‘}’ characters. It should be entirely parallel to how you

Working on an RPN calculator code assignment in Java

This is my second programming class and I am new to Java. I have been working on my first assignment and it involves classes and methods. I know very little about these topics and find myself lost. My assignment asks me to create a RPN calculator that asks the user for two numbers and an operator. The calculator performs the

Count Character Consecutively in Java

I’m trying to write a method that returns the number of times char c first appears consecutively in s, even if it’s a single occurrence of the character. Even spaces break the consecutive count. So …

Can an array be used as a HashMap key?

If a HashMap’s key is a String[] array: Can you access the map by using a newly created String[] array, or does it have to be the same String[] object? Answer It will have to be the same object. A HashMap compares keys using equals() and two arrays in Java are equal only if they are the same object. If

Create a Bitmap/Drawable from file path

I’m trying to create a Bitmap or Drawable from existing file path. But setImageBitmap(), setImageDrawable() doesn’t show an image from the path. I’ve printed path with mText and it looks like : /storage/sdcard0/DCIM/100LGDSC/CAM00001.jpg What am i doing wrong? Anyone can help me? Answer Create bitmap from file path: If you want to scale the bitmap to the parent’s height and

Advertisement