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, 2019 in Apache Spark by nikhil
53 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, 2019 by Gitika
• 32,930 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, 2019 in Apache Spark by Jishan
142 views
0 votes
1 answer

Error: Loading data to mysql

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

answered Jul 23, 2019 in Apache Spark by Janan
80 views
0 votes
1 answer

error: Caused by: org.apache.spark.SparkException: Failed to execute user defined function.

Hi@akhtar, I think you got this error due to version mismatch ...READ MORE

answered Apr 22 in Apache Spark by MD
• 40,740 points
213 views
+1 vote
2 answers
+1 vote
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,920 points
5,441 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,920 points
800 views
+1 vote
11 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
33,655 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, 2019 in Apache Spark by Gitika
• 32,930 points
139 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, 2019 in Apache Spark by Gitika
• 32,930 points
86 views