error: reassingment to val

0 votes

I got this error when I tried assigning value to variable b in scala shell. Can  anyone tell why did I get this solution?

scala> b = 30
<console>:25: error: reassignment to val

Jul 4 in Apache Spark by nikhil
19 views

1 answer to this question.

0 votes

Hi,

This error will only generate when you try to add different value to the same variable. Check if you have already assigned any value to the variable 'b'. If you use:

scala> val b = 10 

then you try to assign another value to b, then it will give you this error because "val" is a constant it is not going to bearable anymore. If you define something as "val" it will not update that value.

Hope you understand the factor.

answered Jul 4 by Gitika
• 25,360 points

Related Questions In Apache Spark

0 votes
1 answer

Error Loading data to mysql in Spark

You have to use sqoop to export data ...READ MORE

answered Jul 11 in Apache Spark by Jishan
50 views
0 votes
1 answer

Error: Loading data to mysql

You have to use sqoop to export data ...READ MORE

answered Jul 23 in Apache Spark by Janan
44 views
0 votes
1 answer

Is there any way to check the Spark version?

There are 2 ways to check the ...READ MORE

answered Apr 19, 2018 in Apache Spark by nitinrawat895
• 10,730 points
1,470 views
0 votes
1 answer

Which query to use for better performance, join in SQL or using Dataset API?

DataFrames and SparkSQL performed almost about the ...READ MORE

answered Apr 19, 2018 in Apache Spark by kurt_cobain
• 9,260 points
133 views
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
3,371 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
406 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,769 views
0 votes
1 answer

How to calculate the result of formula with Scala?

Hi, You can use a simple mathematical calculation ...READ MORE

answered Jul 1 in Apache Spark by Gitika
• 25,360 points
52 views
0 votes
1 answer

How to execute a function in apache-scala?

Hi, Here is a simple example of how ...READ MORE

answered Jul 1 in Apache Spark by Gitika
• 25,360 points
46 views